Пример #1
0
        public async Task <IActionResult> Create([FromBody] ResourceDetailedDto item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            #region Mapping
            var itemModel = mappService.Map <Resource>(item);
            itemModel.UpdatedUserId = itemModel.CreatedUserId = UserId;
            itemModel.UpdatedTime   = itemModel.CreatedTime = DateTime.Now;
            #endregion

            await resService.Create(itemModel);

            return(Created(
                       this.BaseApiUrl + "/" + itemModel.Id,
                       new { ResourceId = itemModel.Id, itemModel.CreatedTime }
                       ));
        }