public async Task <ApiResult <string> > Post(EditSysOrganizeDto Params) { ApiResult <string> res = new ApiResult <string>(); TokenModelBeta token = JwtToken.ParsingJwtToken(HttpContext); try { SysOrganize sysOrganizeInfo = _mapper.Map <SysOrganize>(Params); sysOrganizeInfo.CreatorTime = DateTime.Now; sysOrganizeInfo.CreatorUserId = token.Id; sysOrganizeInfo.Id = Guid.NewGuid().ToString(); sysOrganizeInfo.DeleteMark = false; var IsSuccess = await _sysOrganizeService.AddAsync(sysOrganizeInfo); if (!IsSuccess) { res.code = (int)ApiEnum.Failure; res.message = "错误:添加组织失败"; } } catch (Exception ex) { res.code = (int)ApiEnum.Error; res.message = "异常:" + ex.Message; } return(await Task.Run(() => res)); }
public async Task <ApiResult <string> > Put(string Id, EditSysOrganizeDto Params) { ApiResult <string> res = new ApiResult <string>(); TokenModelBeta token = JwtToken.ParsingJwtToken(HttpContext); try { SysOrganize sysOrganizeInfo = _mapper.Map <SysOrganize>(Params); sysOrganizeInfo.Id = Id; var IsSuccess = await _sysOrganizeService.UpdateAsync(sysOrganizeInfo); if (!IsSuccess) { res.code = (int)ApiEnum.Failure; res.message = "错误:修改组织失败"; } } catch (Exception ex) { res.code = (int)ApiEnum.Error; res.message = "异常:" + ex.Message; } return(await Task.Run(() => res)); }