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)));
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
 public void Put(int id, [FromBody] WorkingHoursDto value)
 {
     _workinghoursService.Update(WorkingHoursMapper.Map(value));
 }
Exemplo n.º 4
0
 public void Post([FromBody] WorkingHoursDto value)
 {
     _workinghoursService.Create(WorkingHoursMapper.Map(value));
 }
Exemplo n.º 5
0
 public WorkingHoursDto Get(int id)
 {
     return(WorkingHoursMapper.Map(_workinghoursService.Get(id)));
 }
Exemplo n.º 6
0
 public IEnumerable <WorkingHoursDto> Get()
 {
     return(_workinghoursService.GetAll().Select(a => WorkingHoursMapper.Map(a)).ToList());
 }