public ActionResult AllDispatches() { var regService = ServiceCreator.GetRegistrationService(); var account = regService.FindAccount(User.Identity.Name); if (account != null) { var service = ServiceCreator.GetDispatchesService(); var activeDispatches = service.GetActiveDispatches(account.Id); var oldDispatches = service.GetInActiveDispatches(account.Id); var model = new DispatchListViewModel(); model.ActiveDispatches = Mapper.Map <List <DispatchViewModel> >(activeDispatches); model.InActiveDispatches = Mapper.Map <List <DispatchViewModel> >(oldDispatches); return(View("DispatchCardList", model)); } else { var model = new DispatchListViewModel(); model.ActiveDispatches = new List <DispatchViewModel>(); model.InActiveDispatches = new List <DispatchViewModel>(); return(View("DispatchCardList", model)); } }
public bool Login(string login, string password) { var hash = Encrypt(password); var service = ServiceCreator.GetRegistrationService(); var account = service.FindAccount(login); return(account != null && account.PasswordHash == hash); }
public void Register(string login, string password) { var hash = Encrypt(password); var account = new ManagerAccount { Id = Guid.NewGuid(), PasswordHash = hash, Login = login }; var service = ServiceCreator.GetRegistrationService(); service.CreateAccount(account); service.CreateConfig(account.Id); }
public Config FindConfiguration(string login) { var service = ServiceCreator.GetRegistrationService(); var acc = service.FindAccount(login); if (acc != null) { return(service.FindConfig(acc.Id)); } else { throw new AuthException("Account not found"); } }
public void UpdateConfiguration(Config config) { var service = ServiceCreator.GetRegistrationService(); service.UpdateConfig(config); }
public ManagerAccount FindAccount(string login) { var service = ServiceCreator.GetRegistrationService(); return(service.FindAccount(login)); }