public OkObjectResult Put(string id, DateTime dTime, double dRmb, string sCode, int iOperation, string sDesc, string sOwner) { if (string.IsNullOrEmpty(id)) { return(JsonRes.Fail("id无效")); } VsStorageDetail pExist = _storageDetailService.QueryByID(id); if (pExist == null) { return(JsonRes.Fail("数据不存在")); } pExist.DTime = dTime; pExist.FRmb = dRmb; pExist.SCode = sCode; pExist.IOperation = iOperation; pExist.SDesc = sDesc; pExist.SOwner = sOwner; string error = ""; int res = _storageDetailService.TryUpdate(out error, pExist); if (res == 0) { return(JsonRes.Fail(pExist, error)); } return(JsonRes.Success(pExist)); }
public OkObjectResult Post(DateTime dTime, double dRmb, string sCode, int iOperation, string sDesc, string sOwner) { VsStorageDetail entity = new VsStorageDetail { DTime = dTime, FRmb = dRmb, SCode = sCode, IOperation = iOperation, SDesc = sDesc, SOwner = sOwner, }; string error = ""; int res = _storageDetailService.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无效")); } VsStorageDetail pExist = _storageDetailService.QueryByID(id); if (pExist == null) { return(JsonRes.Fail("数据不存在")); } string error = ""; int res = _storageDetailService.TryDelete(out error, pExist); if (res == 0) { return(JsonRes.Fail(pExist, error)); } return(JsonRes.Success(pExist)); }