public IActionResult AddOvertime(OvertimeDTO overtimeDto) { if (overtimeDto.EmployeeId == 0) { var emp = employeeservice.getEmployeeUser(CurrentUser.Id); overtimeDto.EmployeeId = emp.Id; } service.newOvertime(overtimeDto); return(RedirectToAction("Index", "Home")); }
public HttpResponseMessage Post(OvertimeDTO OvertimeDTO) { OvertimeDTO dto = service.newOvertime(OvertimeDTO); if (dto != null) { HttpResponseMessage message = Request.CreateResponse(HttpStatusCode.Created, dto); message.Headers.Location = new Uri(Request.RequestUri + "/" + dto.Id); return(message); } else { return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.add_title)); } }