/* * Update Tag */ public async Task <Tag> UpdateTagAsync(UpdateTagReq tagData) { try { // Update Tag Logger.LogInformation("Update tag"); Tag tag = _uow.GetRepository <Tag>().Get(tagData.Id); tag.Name = tagData.Name; string SlugName = StringHelper.GenerateSlug(tagData.Name); if (!string.IsNullOrEmpty(tagData.Slug)) { SlugName = StringHelper.GenerateSlug(tagData.Slug); } tag.Slug = SlugName; tag.ModifiedBy = tagData.UserId; _uow.GetRepository <Tag>().Update(tag); _uow.SaveChanges(); return(await Task.FromResult(tag)); } catch (Exception ex) { Logger.LogError(ex.Message.ToString()); throw ex; } }
public async Task <ActionResult> UpdateTagAsync([FromBody] UpdateTagReq tag) { var result = await _tagLogic.UpdateTagAsync(tag); return(Ok(new BaseResponse(result))); }