public async Task <ActionResult <V1DTO.WorkingHours> > GetWorkingHours(Guid id) { var workingHours = await _bll.WorkingHourses.FirstOrDefaultAsync(id); if (workingHours == null) { return(NotFound(new V1DTO.MessageDTO($"WorkingHours with id {id} not found"))); } return(Ok(_mapper.Map(workingHours))); }
public async Task <IActionResult> Create(WorkingHoursViewModel workingHoursViewModel) { try { if (ModelState.IsValid) { await _workingHoursService.AddAsync(WorkingHoursMapper.Map(workingHoursViewModel)).ConfigureAwait(false); return(RedirectToAction("details", "project", new { id = workingHoursViewModel.ProjectId })); } return(View(workingHoursViewModel)); } catch (Exception) { ErrorViewModel model = new ErrorViewModel { RequestId = "Kunne ikke indberette arbejdstimer" }; return(View("Error", model)); } }
public void Put(int id, [FromBody] WorkingHoursDto value) { _workinghoursService.Update(WorkingHoursMapper.Map(value)); }
public void Post([FromBody] WorkingHoursDto value) { _workinghoursService.Create(WorkingHoursMapper.Map(value)); }
public WorkingHoursDto Get(int id) { return(WorkingHoursMapper.Map(_workinghoursService.Get(id))); }
public IEnumerable <WorkingHoursDto> Get() { return(_workinghoursService.GetAll().Select(a => WorkingHoursMapper.Map(a)).ToList()); }