Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SumaryPime sumaryPime = db.SumaryPime.Find(id);

            db.SumaryPime.Remove(sumaryPime);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Email,Phone,Address")] SumaryPime sumaryPime)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sumaryPime).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sumaryPime));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Email,Phone,Address")] SumaryPime sumaryPime)
        {
            if (ModelState.IsValid)
            {
                db.SumaryPime.Add(sumaryPime);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sumaryPime));
        }
Example #4
0
        // GET: SumaryPimes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SumaryPime sumaryPime = db.SumaryPime.Find(id);

            if (sumaryPime == null)
            {
                return(HttpNotFound());
            }
            return(View(sumaryPime));
        }
Example #5
0
        // GET: Products/Details/5
        public ActionResult SumaryDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
            }
            SumaryPime sumaryPime = db.SumaryPime.Find(id);

            if (sumaryPime == null)
            {
                return(HttpNotFound());
            }
            return(View(sumaryPime));
        }
Example #6
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());
        }