Exemple #1
0
        public IActionResult Delete(HolidayEntitlement holidayentitlement)
        {
            _holidayEntitlement.DeleteHolidayEntitlement(holidayentitlement);
            var holidayEntitlement = _holidayEntitlement.GetAllHolidayEntitlement().OrderBy(p => p.Id);

            return(View("Details", holidayEntitlement));
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
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));
        }
Exemple #4
0
        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());
            }
        }
Exemple #5
0
 public void AddHolidayEntitlement(HolidayEntitlement holidayEntitlement)
 {
     _appDbContext.HolidayEntitlements.Add(holidayEntitlement);
     _appDbContext.SaveChanges();
 }
Exemple #6
0
 public void DeleteHolidayEntitlement(HolidayEntitlement holidayEntitlement)
 {
     _appDbContext.HolidayEntitlements.Remove(holidayEntitlement);
     _appDbContext.SaveChanges();
 }
Exemple #7
0
 public void EditHolidayEntitlement(HolidayEntitlement holidayEntitlement)
 {
     _appDbContext.HolidayEntitlements.Update(holidayEntitlement);
     _appDbContext.SaveChanges();
 }