public int EditSalary(EmployeeSalaryInputModel model) { var Salary = this.db.Salaries.Where(x => x.UserId == model.UserId).FirstOrDefault(); Salary.EmployeeSalary = model.Salary; this.db.Entry(Salary).State = EntityState.Detached; this.db.Update(Salary); this.db.SaveChanges(); return(this.db.Users.FirstOrDefault(x => x.Id == model.UserId).UsersStore.StoreId); }
public int CreateSalary(EmployeeSalaryInputModel model) { var Salary = this.mapper.Map <EmployeeSalaryInputModel, Salary>(model); this.db.Salaries.Add(Salary); this.db.SaveChanges(); var StoreId = this.db.Users.Where(x => x.Id == model.UserId).FirstOrDefault(); return(StoreId.UsersStore.StoreId); }
public IActionResult EditSalary(EmployeeSalaryInputModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var StoreId = this.service.EditSalary(model); return(this.RedirectToAction("Edit", new { id = StoreId })); }