public OkObjectResult Put(string id, DateTime dTime, double dRmb, string sName, string sTCode, string sCode, string sDesc, string sOwner) { if (string.IsNullOrEmpty(id)) { return(JsonRes.Fail("id无效")); } VsSpendingDetail pExist = _spendingDetailService.QueryByID(id); if (pExist == null) { return(JsonRes.Fail("数据不存在")); } pExist.DTime = dTime; pExist.FRmb = dRmb; pExist.SName = sName; pExist.SCode = sCode; pExist.SDesc = sDesc; pExist.SOwner = sOwner; pExist.STCode = sTCode; string error = ""; int res = _spendingDetailService.TryUpdate(out error, pExist); if (res == 0) { return(JsonRes.Fail(pExist, error)); } return(JsonRes.Success(pExist)); }
public OkObjectResult Post(DateTime dTime, double dRmb, string sName, string sTCode, string sCode, string sDesc, string sOwner) { VsSpendingDetail entity = new VsSpendingDetail { DTime = dTime, FRmb = dRmb, SName = sName, SCode = sCode, SDesc = sDesc, SOwner = sOwner, STCode = sTCode }; string error = ""; int res = _spendingDetailService.TryAdd(out error, entity); if (res == 0) { return(JsonRes.Fail(entity, error)); } return(JsonRes.Success(entity)); }
public OkObjectResult Delete(string id) { if (string.IsNullOrEmpty(id)) { return(JsonRes.Fail("id无效")); } VsSpendingDetail pExist = _spendingDetailService.QueryByID(id); if (pExist == null) { return(JsonRes.Fail("数据不存在")); } string error = ""; int res = _spendingDetailService.TryDelete(out error, pExist); if (res == 0) { return(JsonRes.Fail(pExist, error)); } return(JsonRes.Success(pExist)); }