Esempio n. 1
0
        public int AddVacationShedule(VacationShedule model)
        {
            if (!model.vacationTransfer)
            {
                model.causeTransferComment = null;
            }
            var res = _context.VacationShedule.Add(model);

            _context.SaveChanges();
            return(res.Entity.Id);
        }
 public IActionResult PostVacationShedule(VacationShedule model)
 {
     try
     {
         var res = _repository.AddVacationShedule(model);
         return(Ok(res));
     }
     catch (Exception error)
     {
         return(BadRequest(error));
     }
 }
 public IActionResult PutVacationShedule(int id, VacationShedule model)
 {
     try
     {
         var res = _repository.UpdateVacationShedule(id, model);
         return(Ok(res));
     }
     catch (Exception error)
     {
         return(BadRequest(error));
     }
 }
Esempio n. 4
0
        public bool UpdateVacationShedule(int id, VacationShedule model)
        {
            var res = _context.VacationShedule.FirstOrDefault(x => x.Id == id && x.deleted == false);

            if (res == null)
            {
                return(false);
            }
            res.dateStart             = model.dateStart;
            res.dateEnd               = model.dateEnd;
            res.replacementEmployeeId = model.replacementEmployeeId;
            res.vacationEntitlementId = model.vacationEntitlementId;
            res.vacationTransfer      = model.vacationTransfer;
            res.causeTransferComment  = model.causeTransferComment;
            _context.SaveChanges();
            return(true);
        }