コード例 #1
0
        public async Task <IActionResult> PutWorkingHours(Guid id, V1DTO.WorkingHours workingHours)
        {
            if (id != workingHours.Id)
            {
                return(BadRequest(new V1DTO.MessageDTO("Id and WorkingHours.Id do not match")));
            }

            await _bll.WorkingHourses.UpdateAsync(_mapper.Map(workingHours));

            await _bll.SaveChangesAsync();

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <V1DTO.WorkingHours> > PostWorkingHours(V1DTO.WorkingHours workingHours)
        {
            var bllEntity = _mapper.Map(workingHours);

            _bll.WorkingHourses.Add(bllEntity);
            await _bll.SaveChangesAsync();

            workingHours.Id = bllEntity.Id;

            return(CreatedAtAction("GetWorkingHours",
                                   new { id = workingHours.Id, version = HttpContext.GetRequestedApiVersion()?.ToString() ?? "0" },
                                   workingHours));
        }