In a simple application I am creating there are Admin and users where admin can create users. Right now I am creating Classes that encapsulate database CRUD calls with methods.
For example: adminStore.CreateUser(userObject)
will persist that user object into the Database and return the object. I am now confused as to which DataAccess entity I need to attach methods like these. Doing them on adminStore
will make them sensible in sense developer would understand that admin is creating the user and has access role. But from another perspective the below to sounds logical.
like: userStore.CreateUser(userObject);
.
So my questions would somewhat sound like a Api design,Class design question but I would like to know which if the below is the right one.
1 UserStore.CreateUser(userObject)
2 AdminStore.CreateUser(userObject)
Update: Here is what i came up with later after viewing the answers.
User { Name ,Email, Password }
Admin:User,IImplementsAdmin { FlagPost() etc etc }
AdminStore { CreateUser(), SetUserStatus() }