public async Task <IActionResult> LocalRestrict([FromBody] LocalRestrictionRequestModel requestModel) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var employee = await _restrictionRepository.GetById(requestModel.EmployeeId); if (employee == null) { return(BadRequest("No such employee exists")); } employee.LocalDayLimit = requestModel.LocalDayLimit; _restrictionRepository.Update(employee); await _restrictionRepository.SaveChanges(); return(Ok()); } catch (DbUpdateConcurrencyException e) { return(BadRequest(e.Message)); } catch (Exception e) { return(BadRequest(e.Message)); } }