Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SaleToner saleToner = db.SaleToners.Find(id);

            db.SaleToners.Remove(saleToner);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ApplicationDbContext db = new ApplicationDbContext();

            SaleToner saleToner = db.SaleToners.Find(id);

            db.SaleToners.Remove(saleToner);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "SaleTonerID,SaleTonerDate,TonerPrice,OwnerID,TonerID,TonerQuantity,InvoiceNo")] SaleToner saleToner)
 {
     if (ModelState.IsValid)
     {
         db.Entry(saleToner).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerName", saleToner.OwnerID);
     ViewBag.TonerID = new SelectList(db.Toners, "TonerID", "TonerModel", saleToner.TonerID);
     return(View(saleToner));
 }
Beispiel #4
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SaleToner saleToner = db.SaleToners.Find(id);

            if (saleToner == null)
            {
                return(HttpNotFound());
            }
            return(View(saleToner));
        }
Beispiel #5
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SaleToner saleToner = db.SaleToners.Find(id);

            if (saleToner == null)
            {
                return(HttpNotFound());
            }
            ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerName", saleToner.OwnerID);
            ViewBag.TonerID = new SelectList(db.Toners, "TonerID", "TonerModel", saleToner.TonerID);
            return(View(saleToner));
        }
        public ActionResult Create([Bind(Include = "SaleTonerID,SaleTonerDate,TonerPrice,OwnerID,TonerID,TonerQuantity,InvoiceNo")] SaleToner saleToner)
        {
            ApplicationDbContext db = new ApplicationDbContext();

            if (ModelState.IsValid)
            {
                db.SaleToners.Add(saleToner);
                db.SaveChanges();
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                LogJobs.LogSuccess(saleToner.SaleTonerID.ToString(), controllerName, actionName);
                return(RedirectToAction("Index"));
            }

            ViewBag.OwnerID = new SelectList(db.Owners, "OwnerID", "OwnerName", saleToner.OwnerID);
            ViewBag.TonerID = new SelectList(db.Toners, "TonerID", "TonerModel", saleToner.TonerID);
            return(View(saleToner));
        }
        public ActionResult Edit(int?id)
        {
            ApplicationDbContext db = new ApplicationDbContext();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SaleToner saleToner = db.SaleToners.Find(id);

            if (saleToner == null)
            {
                return(HttpNotFound());
            }
            var orderedOwners = db.Owners.OrderBy(c => c.OwnerName);
            var orderedToners = db.Toners.OrderBy(c => c.TonerModel);

            ViewBag.OwnerID = new SelectList(orderedOwners, "OwnerID", "OwnerName", saleToner.OwnerID);
            ViewBag.TonerID = new SelectList(orderedToners, "TonerID", "TonerModel", saleToner.TonerID);
            return(View(saleToner));
        }