public IActionResult Delete(HolidayEntitlement holidayentitlement) { _holidayEntitlement.DeleteHolidayEntitlement(holidayentitlement); var holidayEntitlement = _holidayEntitlement.GetAllHolidayEntitlement().OrderBy(p => p.Id); return(View("Details", holidayEntitlement)); }
public float GetUserHolidayEntitlement(string userId, int year) { HolidayEntitlement holidayEntitlement = _appDbContext.HolidayEntitlements.FirstOrDefault(p => p.Users.Id == userId & p.Year == year); if (holidayEntitlement != null) { return(holidayEntitlement.YearsEntitlement); } else { return(0); } }
public IActionResult Edit(HolidayEntitlementView HolidayEntitlementView) { if (ModelState.IsValid) { HolidayEntitlement PostedholidayEntitlement = new HolidayEntitlement(); PostedholidayEntitlement.Users = _userManager.Users.FirstOrDefault(p => p.Id == HolidayEntitlementView.UserId); PostedholidayEntitlement.Year = HolidayEntitlementView.Year; PostedholidayEntitlement.YearsEntitlement = HolidayEntitlementView.YearsEntitlement; PostedholidayEntitlement.Id = HolidayEntitlementView.Id; _holidayEntitlement.EditHolidayEntitlement(PostedholidayEntitlement); } var holidayEntitlement = _holidayEntitlement.GetAllHolidayEntitlement().OrderBy(p => p.Id); return(View("Details", holidayEntitlement)); }
public IActionResult Create(HolidayEntitlementView HolidayEntitlementView) { if (ModelState.IsValid) { HolidayEntitlement holidayEntitlement = new HolidayEntitlement(); holidayEntitlement.Users = _userManager.Users.FirstOrDefault(p => p.Id == HolidayEntitlementView.UserId); holidayEntitlement.Year = HolidayEntitlementView.Year; holidayEntitlement.YearsEntitlement = HolidayEntitlementView.YearsEntitlement; _holidayEntitlement.AddHolidayEntitlement(holidayEntitlement); var bob = _holidayEntitlement.GetAllHolidayEntitlement().OrderBy(p => p.Id); return(View("Details", bob)); } else { return(View()); } }
public void AddHolidayEntitlement(HolidayEntitlement holidayEntitlement) { _appDbContext.HolidayEntitlements.Add(holidayEntitlement); _appDbContext.SaveChanges(); }
public void DeleteHolidayEntitlement(HolidayEntitlement holidayEntitlement) { _appDbContext.HolidayEntitlements.Remove(holidayEntitlement); _appDbContext.SaveChanges(); }
public void EditHolidayEntitlement(HolidayEntitlement holidayEntitlement) { _appDbContext.HolidayEntitlements.Update(holidayEntitlement); _appDbContext.SaveChanges(); }