public async Task <RequestDto> CreateAsync(RequestDto itemDto, ICollection <Claim> roles) { var result = await requestService.CreateAsync(itemDto, roles); await CreateHistoryAsync(result); return(result); }
public async Task <ActionResult <RequestModel> > CreateItemAsync([FromForm] RequestCreateUpdateModel requestCreateUpdateModel) { var roles = GetUserRoles(); RequestDto itemDto = _mapper.Map <RequestCreateUpdateModel, RequestDto>(requestCreateUpdateModel); itemDto = await _requestService.CreateAsync(itemDto, roles); var itemModel = _mapper.Map <RequestDto, RequestModel>(itemDto); return(CreatedItem <RequestModel, Guid>(itemModel)); }
public async Task <HttpResponseMessage> Post(UnwrapModel <RequestSaveModel> model) { if (model?.Data != null) { model.Data.PlannedDate = HttpUtility.UrlDecode(model.Data.PlannedDate); await requestService.CreateAsync(model.Data); return(Success()); } return(Failure("Невозможно добавить пустой элемент")); }