コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BillingTypeUser billingTypeUser = db.BillingTypeUser.Find(id);

            db.BillingTypeUser.Remove(billingTypeUser);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,IdSumaryPime,IdBillingType")] BillingTypeUser billingTypeUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(billingTypeUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdBillingType = new SelectList(db.BillingType, "Id", "TYPE", billingTypeUser.IdBillingType);
     ViewBag.IdSumaryPime  = new SelectList(db.SumaryPime, "Id", "Name", billingTypeUser.IdSumaryPime);
     return(View(billingTypeUser));
 }
コード例 #3
0
        // GET: BillingTypeUsers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BillingTypeUser billingTypeUser = db.BillingTypeUser.Find(id);

            if (billingTypeUser == null)
            {
                return(HttpNotFound());
            }
            return(View(billingTypeUser));
        }
コード例 #4
0
        // GET: BillingTypeUsers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BillingTypeUser billingTypeUser = db.BillingTypeUser.Find(id);

            if (billingTypeUser == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdBillingType = new SelectList(db.BillingType, "Id", "TYPE", billingTypeUser.IdBillingType);
            ViewBag.IdSumaryPime  = new SelectList(db.SumaryPime, "Id", "Name", billingTypeUser.IdSumaryPime);
            return(View(billingTypeUser));
        }
コード例 #5
0
        public ActionResult Sumary([Bind(Include = "Name,Email,Phone,Address,NameProduct,UnitPrice,IdBillingType,Reference")] FullSumary fullSumary)
        {
            if (ModelState.IsValid)
            {
                SumaryPime sumaryPime = new SumaryPime
                {
                    Name    = fullSumary.Name,
                    Email   = fullSumary.Email,
                    Phone   = fullSumary.Phone,
                    Address = fullSumary.Address
                };

                db.SumaryPime.Add(sumaryPime);
                db.SaveChanges();

                Product product = new Product
                {
                    NameProduct  = fullSumary.NameProduct,
                    UnitPrice    = fullSumary.UnitPrice,
                    IdSumaryPime = sumaryPime.Id
                };

                db.Product.Add(product);
                db.SaveChanges();

                BillingTypeUser billingTypeUser = new BillingTypeUser
                {
                    IdSumaryPime  = sumaryPime.Id,
                    IdBillingType = fullSumary.IdBillingType,
                    Reference     = fullSumary.Reference
                };

                db.BillingTypeUser.Add(billingTypeUser);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdBillingType = new SelectList(db.BillingType, "Id", "TYPE");
            return(View());
        }