public void Add(AddOrUpdateCategoryReq req) { var obj = req.MapTo <Category>(); obj.CreateTime = DateTime.Now; var user = _auth.GetCurrentUser().User; obj.CreateUserId = user.Id; obj.CreateUserName = user.Name; Repository.Add(obj); }
public string Update(AddOrUpdateCategoryReq obj) { Response resp = new Response(); try { _app.Update(obj); } catch (Exception e) { resp.Code = 500; resp.Message = e.Message; } return(JsonHelper.Instance.Serialize(resp)); }
public void Update(AddOrUpdateCategoryReq obj) { var user = _auth.GetCurrentUser().User; UnitWork.Update <Category>(u => u.Id == obj.Id, u => new Category { Enable = obj.Enable, DtValue = obj.DtValue, DtCode = obj.DtCode, TypeId = obj.TypeId, UpdateTime = DateTime.Now, UpdateUserId = user.Id, UpdateUserName = user.Name //todo:要修改的字段赋值 }); }
public Response Update(AddOrUpdateCategoryReq obj) { var result = new Response(); try { _app.Update(obj); } catch (Exception ex) { result.Code = 500; result.Message = ex.InnerException?.Message ?? ex.Message; } return(result); }