public async Task <ActionResult <ResponseData> > Update(Guid id, GroupEditVm model) { try { var input = _mapper.Map <GroupEditVm, GroupInput>(model, opts => { opts.AfterMap((GroupEditVm s, GroupInput d) => { d.Id = id; d.CurrentUserId = GetUserId(); d.CurrentEmployeeId = GetEmployeeId(); }); }); var result = await _groupAppService.UpdateAsync(input); if (result.IsSuccess) { return(BuildSuccess()); } var msg = "未知业务错误"; if (result.FailedCode == FailedCodes.Group_NotCreatedBy) { msg = "不是所有者,不能编辑/添加成员/删除成员"; } return(BuildFaild(result.FailedCode, msg)); } catch (Exception ex) { return(BadRequest(LogError(_logger, ex))); } }
public virtual Task <GroupDto> UpdateAsync(Guid id, GroupUpdateDto input) { return(_groupAppService.UpdateAsync(id, input)); }