public async Task <IActionResult> Update([FromRoute] int resourceId, [FromBody] ResourceDetailedDto item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } #region Mapping var itemModel = mappService.Map <Resource>(item); itemModel.UpdatedUserId = UserId; itemModel.UpdatedTime = DateTime.Now; itemModel.Id = resourceId; #endregion await resService.Update(itemModel); return(Ok(new { itemModel.UpdatedTime })); }
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 } )); }