public async Task <ApiResult> Update(ConstructionPlanMonthChart obj) { ApiResult ret = new ApiResult(); try { ConstructionPlanMonthChart et = await _repo.GetByID(obj.Id); if (et != null) { DateTime dt = DateTime.Now; //obj.UpdatedTime = dt; //obj.UpdatedBy = _userID; ret.data = await _repo.Update(obj); ret.code = Code.Success; } else { ret.code = Code.DataIsnotExist; ret.msg = "所要修改的数据不存在"; } return(ret); } catch (Exception ex) { ret.code = Code.Failure; ret.msg = ex.Message; return(ret); } }
public async Task <ActionResult <ApiResult> > Update(ConstructionPlanMonthChart obj) { ApiResult ret = new ApiResult { code = Code.Failure }; try { ret = await _service.Update(obj); } catch (System.Exception ex) { ret.msg = string.Format( "更新数据ConstructionPlanMonthChart失败, 异常信息:{0}", ex.Message); } return(ret); }
public async Task <ApiResult> GetByID(int id) { ApiResult ret = new ApiResult(); try { ConstructionPlanMonthChart obj = await _repo.GetByID(id); ret.data = obj; ret.code = Code.Success; return(ret); } catch (Exception ex) { ret.code = Code.Failure; ret.msg = ex.Message; return(ret); } }
public async Task <ApiResult> Save(ConstructionPlanMonthChart obj) { ApiResult ret = new ApiResult(); try { DateTime dt = DateTime.Now; ret.data = await _repo.Save(obj); ret.code = Code.Success; return(ret); } catch (Exception ex) { ret.code = Code.Failure; ret.msg = ex.Message; return(ret); } }