public void Update(WorkerDTO item) { var worker = entities.Workers.FirstOrDefault(s => s.id == item.id); if (worker != null) { worker.lastName = item.lastName; worker.firstName = item.firstName; worker.password = item.password; entities.SaveChanges(); } }
public void LoginHelperWorkerSuccessfullLoginTest() { var mockCustomerService = new Mock<ICustomerDTOService>(); var mockWorkerService = new Mock<IWorkerDTOService>(); string login = "******"; string password = "******"; WorkerDTO w = new WorkerDTO() {login = login,password = SecurePasswordHasher.Hash(password)}; mockCustomerService.Setup(s => s.Get("test")).Returns(Task.FromResult((CustomerDTO)null)); mockWorkerService.Setup(s => s.Get(login)).Returns(Task.FromResult(w)); string msg; var result = AccountHelper.ValidateLogin(login, password, mockCustomerService.Object, mockWorkerService.Object, out msg); Assert.IsTrue(result != null); Assert.IsTrue(msg == string.Empty); }
public CarEditViewModel(CarDTO c,WorkerDTO w) { this.w = w; GetStations(c); Brand = c.brand; Model = c.model; Colour = c.colour; ProductionDate = c.productionDate; Price = c.price; IsEfficient = c.isEfficient; Id = c.Id; }
public async Task<bool> Put(WorkerDTO item) { return await this.Put<WorkerDTO, bool>("PUT", item); }
public StationAddViewModel(WorkerDTO w) { this.w = w; }
public StationEditView(StationDTO s,WorkerDTO w) { InitializeComponent(); DataContext = new StationEditViewModel(s,w); }
public CarAddView(WorkerDTO w) { InitializeComponent(); DataContext = new CarAddViewModel(w); cmbColors.ItemsSource = typeof(Colors).GetProperties(); }
public CarEditView(CarDTO c,WorkerDTO w) { InitializeComponent(); DataContext = new CarEditViewModel(c,w); }
public void ChangePasswordAdminInCorrectPasswordTest() { var mockCustomerService = new Mock<ICustomerDTOService>(); var mockWorkerService = new Mock<IWorkerDTOService>(); string login = "******"; string password = "******"; CustomerDTO customer = new CustomerDTO() { userName = login, password = SecurePasswordHasher.Hash(password) }; WorkerDTO worker = new WorkerDTO() { login = login, password = SecurePasswordHasher.Hash(password+password) }; mockCustomerService.Setup(s => s.Get(login)).Returns(Task.FromResult(customer)); mockCustomerService.Setup(s => s.Put(customer)).Returns(Task.FromResult(true)); mockWorkerService.Setup(s => s.Get(login)).Returns(Task.FromResult(worker)); mockWorkerService.Setup(s => s.Put(worker)).Returns(Task.FromResult(true)); Claim c = new Claim(ClaimTypes.Role, Roles.AdminRole); string msg; var result = AccountHelper.ValidateChangePassword(c, login, password, password + password, mockCustomerService.Object, mockWorkerService.Object, out msg); Assert.IsTrue(!result); Assert.IsTrue(msg != string.Empty); Assert.IsTrue(msg==Messages.IncorrectPassword); }
public WorkerPanelViewModel(WorkerDTO w) { Messenger.Default.Register<FireRefresh> ( this, (action) => Refresh() ); _logInInfo = w.login.ToString(); this.w = w; SearchProductionDate = new DateTime(2000, 1, 1); SearchPrice = 10000; }
public StationEditViewModel(StationDTO e,WorkerDTO w) { City = e.city; Street = e.street; ZipCode = e.zipCode; StreetNo = e.streetNumer.ToString(); selected = e; this.w = w; }
public StationAddView(WorkerDTO w) { InitializeComponent(); DataContext = new StationAddViewModel(w); }
public CarAddViewModel(WorkerDTO w) { this.w = w; GetStations(); ProductionDate = new DateTime(2000, 01, 01); GetUniqueBrands(); }