예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ExtraCharge extraCharge = db.extraCharges.Find(id);

            db.extraCharges.Remove(extraCharge);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "EC_id,del_charge,free_delivery,GSTNumber,GSTPercentage,Chargename,chargeinrupees")] ExtraCharge extraCharge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(extraCharge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(extraCharge));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "EC_id,del_charge,free_delivery,GSTNumber,GSTPercentage,Chargename,chargeinrupees")] ExtraCharge extraCharge)
        {
            if (ModelState.IsValid)
            {
                db.extraCharges.Add(extraCharge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(extraCharge));
        }
예제 #4
0
        // GET: ExtraCharges/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExtraCharge extraCharge = db.extraCharges.Find(id);

            if (extraCharge == null)
            {
                return(HttpNotFound());
            }
            return(View(extraCharge));
        }
예제 #5
0
 public int CreateExtraCharge(ExtraCharge extraCharge)
 {
     _db.ExtraCharges.Add(extraCharge);
     _db.SaveChanges();
     return(extraCharge.Id);
 }
예제 #6
0
        public void Seed()
        {
            _splitThatBillContext.Database.ExecuteSqlRaw("CALL Add_Currencies");
            var person1 = new Person("lhar", "gil");

            person1.SetExternalId(_externalIdGenerator.Generate());
            person1.AddPaymentDetail(PaymentDetail.Create("Maybank", "34532156778", "Lhar Gil"));

            var person2 = new Person("jon", "snow");

            person2.SetExternalId(_externalIdGenerator.Generate());
            var person3 = new Person("raffy", "tulfo");

            person3.SetExternalId(_externalIdGenerator.Generate());

            if (!_splitThatBillContext.People.Any())
            {
                _splitThatBillContext.People.Add(person1);
                _splitThatBillContext.People.Add(person2);
                _splitThatBillContext.People.Add(person3);
            }

            if (!_splitThatBillContext.Bills.Any())
            {
                var billItem1 = new BillItem("Cup of rice", 3.0M);
                var billITem2 = new BillItem("Ayam goreng", 7.0M);
                var bill      = new Bill("Sri Ayutthaya",
                                         _dateTimeManager.Today,
                                         new List <BillItem> {
                    billItem1,
                    billITem2
                }, "MYR");
                bill.SetExternalId(_externalIdGenerator.Generate());
                bill.AddParticipant(person3);
                bill.AddParticipant(person2);
                bill.AddParticipant(person1);

                var extraCharge1 = new ExtraCharge("Service charge", 0.10M);
                var extraCharge2 = new ExtraCharge("SST", 0.06M);
                bill.AddExtraCharge(extraCharge1);
                bill.AddExtraCharge(extraCharge2);

                person2.AddBillItem(billItem1, billItem1.UnitPrice);
                bill.UpdateBillTaker(person1);

                _splitThatBillContext.Bills.Add(bill);

                var billItem3 = new BillItem("Nasi lemak", 10.0M);
                var billItem4 = new BillItem("Avocado toast", 15.5M);
                var bill2     = new Bill("Feebay.co", _dateTimeManager.Today,
                                         new List <BillItem> {
                    billItem3,
                    billItem4
                }, "MYR");
                bill2.SetExternalId(_externalIdGenerator.Generate());
                bill2.AddParticipant(person1);
                bill2.AddParticipant(person2);

                person1.AddBillItem(billItem4, billItem4.UnitPrice);
                var extraCharge3 = new ExtraCharge("Service charge", 0.10M);
                var extraCharge4 = new ExtraCharge("SST", 0.06M);
                bill2.AddExtraCharge(extraCharge3);
                bill2.AddExtraCharge(extraCharge4);

                bill2.UpdateBillTaker(person1);

                _splitThatBillContext.Bills.Add(bill2);

                _splitThatBillContext.SaveChanges();
            }
        }
예제 #7
0
 public void AddExtraCharge(ExtraCharge extraCharge)
 {
     ExtraCharges.Add(extraCharge);
 }