Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ISomeUsefulName
- {
- IList<User> FetchUsers();
- User FetchUser(int userId);
- bool SaveUser(User user);
- bool DeleteUser(int userId);
- }
- public interface IRepository<TYPE, KEY>{
- IList<TYPE> GetAll(KEY key);
- TYPE GetById(KEY key);
- void Save(TYPE obj);
- void Update(TYPE obj);
- void Delete(Key key);
- }
- public interface IUserRepository : IRepository<User, int>
- {
- IList<User> GetAllMyFavorites(ICriteria crit);
- IList<Events> GetHistoryByUser(User user);
- }
- public UserController {
- private _userRepository = null;
- private _eventsRepository = null;
- public UserController(IUserRepository userRepository,
- IRepository<Events,int> eventsRepository)
- // if you are doing here just CRUD use the generic signature
- {
- _userRepository = userRepository;
- _eventsRepository = eventsRepository;
- }
- public MarkItAsGoldPartener(int userId){
- var user = userRepository.GetById(userId);
- user.PartnerType = PartnerTypes.Gold;
- userRepository.Save(user); // the user in member name is useless
- eventsRepository.Save(new Event(){Message = "The user" + UserId + "is golden" });
- }
- }
- public interface IUserList
- {
- IList<User> FetchUsers();
- }
- public interface IUser
- {
- User FetchUser(int userId);
- }
- public interface IUserStore
- {
- bool SaveUser(User user);
- bool DeleteUser(int userId);
- }
- ICrud<T> { }
- IStore<T> { }
Add Comment
Please, Sign In to add comment