public ActionResult Add(Bill collection)
        {
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                try
                {
                    Bill bill = new Bill();
                    bill.CreationDate = DateTime.Now;
                    bill.ModifyDate = DateTime.Now;
                    bill.Version = 1;
                    bill.UserId = 1;
                    bill.PaymentTypeId = 4;
                    bill.IsActive = true;

                    bill.Amount = collection.Amount;
                    bill.DueDate = collection.DueDate;
                    bill.IssueDate = collection.IssueDate;
                    bill.Name = collection.Name;
                    bill.Payee = collection.Payee;
                    bill.Shared = collection.Shared;
                    bill.StaysSame = collection.StaysSame;

                    context.Bills.InsertOnSubmit(bill);
                    context.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View(collection);
                }
            }
        }
Beispiel #2
0
 public DashboardItem(Bill bill)
 {
     Id = bill.Id;
     Name = bill.Name;
     Date = bill.DueDate;
     Amount = bill.Amount;
     IsPastDue = DueInDays < 0;
     IsShared = bill.Shared;
     Type = "Bill";
     IsPaid = false;
 }
Beispiel #3
0
 public SharedBill(Bill bill, ApplicationUser user, SharedPercentage percentage)
 {
     Bill             = bill;
     SharedWithUser   = user;
     SharedPercentage = percentage;
 }
Beispiel #4
0
 public SharedBill()
 {
     Bill = new Bill();
 }
 partial void DeleteBill(Bill instance);
 partial void UpdateBill(Bill instance);
 partial void InsertBill(Bill instance);
		private void detach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
		private void attach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
		private void detach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = null;
		}
		private void attach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = this;
		}
        public ActionResult Edit(int id, Bill collection)
        {
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                Bill bill = context.GetBill(id);

                try
                {
                    bill.ModifyDate = DateTime.Now;
                    bill.Version += 1;
                    bill.Name = collection.Name;
                    bill.Payee = collection.Payee;
                    bill.DueDate = collection.DueDate;
                    bill.Amount = collection.Amount;
                    bill.IssueDate = collection.IssueDate;
                    bill.StaysSame = collection.StaysSame;
                    bill.Shared = collection.Shared;

                    context.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View(bill);
                }
            }
        }