/// <summary> /// 新增标签 /// </summary> public virtual async Task <TagetEditDto> CreateTagetAsync(TagetEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <Taget>(); entity = await _TagetRepository.InsertAsync(entity); return(entity.MapTo <TagetEditDto>()); }
/// <summary> /// 编辑标签 /// </summary> public virtual async Task UpdateTagetAsync(TagetEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _TagetRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _TagetRepository.UpdateAsync(entity); }
public ActionResult Save(TagetEditDto dto) { try { Tagetservice.CreateOrUpdateTagetAsync(new CreateOrUpdateTagetInput { TagetEditDto = dto }); return(Success()); } catch (Exception e) { return(Fail(e.InnerException.Message)); } }
/// <summary> /// 通过Id获取标签信息进行编辑或修改 /// </summary> public GetTagetForEditOutput GetTagetForEdit(NullableIdDto <long> input) { var output = new GetTagetForEditOutput(); TagetEditDto TagetEditDto; if (input.Id.HasValue) { var entity = _TagetRepository.Get(input.Id.Value); TagetEditDto = entity.MapTo <TagetEditDto>(); } else { TagetEditDto = new TagetEditDto(); } output.Taget = TagetEditDto; return(output); }