Exemplo n.º 1
0
        public ActionResult AddBill(BillModel model)
        {
            try
            {
                BudgetGuru.DataLayer.Bill_Item bill = new Bill_Item();
                bill.Title = model.billTitle ?? string.Empty;
                bill.Description = model.billDescription ?? string.Empty;
                bill.DueDate = Convert.ToDateTime(model.datepicker);
                bill.Amout = Convert.ToDecimal(model.billAmt);
                bill.addNewBill();

                //if (bill.addNewBill())
                //{
                //    //show success msg or confirmation
                //}
                // TODO: Add insert logic here
                // TODO: Save billdto using data layer
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 2
0
 public ActionResult Delete(int id, BillModel model)
 {
     try
     {
         Bill_Item bill = new Bill_Item();
         //bill.deleteBill(id, d);
         return RedirectToAction("Index");
     }
     catch
     {
         return View("Index");
     }
 }
Exemplo n.º 3
0
 public ActionResult Edit(BillModel model)
 {
     try
     {
         DataClasses1DataContext db = new DataClasses1DataContext();
         BudgetGuru.DataLayer.Bill_Item bill = new Bill_Item();
         Bill_Item item = db.Bill_Items.Single(p => p.Id == model.billId); //Load by primary key. Ideal way to update using Linq-SQL
         //bill.Id = model.billId;
         item.Title = model.billTitle ?? string.Empty;
         item.Description = model.billDescription ?? string.Empty;
         item.DueDate = Convert.ToDateTime(model.datepicker);
         item.Amout = Convert.ToDecimal(model.billAmt);
         db.SubmitChanges();
         //bill.updateBill(model.billId);
         return RedirectToAction("Index");
     }
     catch (Exception e)
     {
         return View();
     }
 }
Exemplo n.º 4
0
        public ActionResult Edit(int id, BillModel model)
        {
            //BudgetGuru.DataLayer.Bill_Item bill = new Bill_Item();
            var bill = new Bill_Item().getBillById(id);
            model.billId = bill.Id;
            model.billAmt = Convert.ToDecimal(bill.Amout);
            model.billDescription = bill.Description;
            model.billTitle = bill.Title;
            model.datepicker = Convert.ToString(bill.DueDate);

            //BUILD THIS
            return View(model);
        }