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)); } }
public override IEnumerable <Restriction> GetAll() => _repository.GetAll();