예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Costumers costumers = db.Costumers.Find(id);

            db.Costumers.Remove(costumers);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Nit,Address,DepartmentId,TownshipId")] Costumers costumers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(costumers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", costumers.DepartmentId);
     ViewBag.TownshipId   = new SelectList(db.Townships, "Id", "TownshipName", costumers.TownshipId);
     return(View(costumers));
 }
예제 #3
0
        // GET: Costumers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Costumers costumers = db.Costumers.Find(id);

            if (costumers == null)
            {
                return(HttpNotFound());
            }
            return(View(costumers));
        }
예제 #4
0
        // GET: Costumers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Costumers costumers = db.Costumers.Find(id);

            if (costumers == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "DepartmentName", costumers.DepartmentId);
            ViewBag.TownshipId   = new SelectList(db.Townships, "Id", "TownshipName", costumers.TownshipId, "0");
            return(View(costumers));
        }