public async Task <IActionResult> GlobalRestrict([FromBody] GlobalRestrictionRequestModel requestModel)
        {
            try
            {
                var employees = await _restrictionRepository.GetAll();

                foreach (var employee in employees)
                {
                    if (!requestModel.GlobalDayLimit.HasValue)
                    {
                        return(BadRequest("Missing global day limit value"));
                    }
                    employee.GlobalDayLimit = requestModel.GlobalDayLimit.Value;

                    _restrictionRepository.Update(employee);
                }

                await _restrictionRepository.SaveChanges();

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#2
0
 public Restriction Update(Restriction restriction)
 {
     return(_repo.Update(restriction));
 }
示例#3
0
        public ReleaseProfile Update(ReleaseProfile restriction)
        {
            restriction.Preferred.Sort(_preferredComparer);

            return(_repo.Update(restriction));
        }