public static Bill SaveBill(BillJson billJson) { if (billJson.CategoryId <= 0 || billJson.SubCategoryId <= 0) { return(null); } if (billJson.BillId <= 0) { return(AddBill(billJson)); } var bill = GetBillById(billJson.BillId); bill.Amount = billJson.Amount; bill.Category = null; bill.CategoryID = billJson.CategoryId; bill.SubCategory = null; bill.SubCategoryID = billJson.SubCategoryId; bill.Description = billJson.Description; bill.Payer = null; bill.PayerID = billJson.PayerId; bill.DueDate = billJson.DueDate; bill.RegDate = DateTime.Now; if (EconomyDataService.SaveBill(bill)) { return(bill); } return(null); }
public static MonthlyBill SaveMonthlyBill(BillJson billJson) { if (billJson.Amount <= 0 || billJson.CategoryId <= 0 || billJson.SubCategoryId <= 0) { return(null); } if (billJson.BillId <= 0) { return(AddMonthlyBill(billJson)); } var bill = GetMonthlyBillById(billJson.BillId); bill.Amount = billJson.Amount; bill.Category = null; bill.CategoryID = billJson.CategoryId; bill.SubCategory = null; bill.SubCategoryID = billJson.SubCategoryId; bill.Description = billJson.Description; bill.Payer = null; bill.PayerID = billJson.PayerId; if (EconomyDataService.SaveMonthlyBill(bill)) { return(bill); } return(null); }
private static MonthlyBill AddMonthlyBill(BillJson billJson) { var bill = CreateMonthlyBill(billJson); if (EconomyDataService.AddMonthlyBill(bill)) { return(bill); } return(null); }
private static MonthlyBill CreateMonthlyBill(BillJson billJson) { var bill = new MonthlyBill(); bill.Amount = billJson.Amount; bill.CategoryID = billJson.CategoryId; bill.SubCategoryID = billJson.SubCategoryId; bill.Description = billJson.Description; bill.PayerID = billJson.PayerId; return(bill); }
private static Bill CreateBill(BillJson billJson) { var bill = new Bill(); bill.Amount = billJson.Amount; bill.CategoryID = billJson.CategoryId; bill.SubCategoryID = billJson.SubCategoryId; bill.Description = billJson.Description; bill.PayerID = billJson.PayerId; bill.DueDate = billJson.DueDate; bill.RegDate = DateTime.Now; return(bill); }
public JsonResult SaveMonthlyBill(BillJson billJson) { var model = EconomyBusiness.SaveMonthlyBill(billJson); return(Json(model)); }