Пример #1
0
        public ActionResult DeleteMetingPoint(int Id)
        {
            var deleted = "";

            var Inv = (from p in db.MetingPoint
                       where p.IdMetingPoint == Id
                       select p).ToList <MetingPoint>();


            if (Inv.Count() > 0)
            {
                MetingPoint MetingPoint = db.MetingPoint.Find(Id);
                db.MetingPoint.Remove(MetingPoint);
                db.SaveChanges();

                deleted          = "true";
                @ViewBag.Message = "Sucess";
            }
            else
            {
                deleted = "false";
            }


            return(Json(new { success = true, deleted },
                        JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MetingPoint metingPoint = db.MetingPoint.Find(id);

            db.MetingPoint.Remove(metingPoint);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "IdMetingPoint,DescMetingPoint")] MetingPoint metingPoint)
 {
     if (ModelState.IsValid)
     {
         db.Entry(metingPoint).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(metingPoint));
 }
Пример #4
0
        public ActionResult Create([Bind(Include = "IdMetingPoint,DescMetingPoint")] MetingPoint metingPoint)
        {
            if (ModelState.IsValid)
            {
                db.MetingPoint.Add(metingPoint);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(metingPoint));
        }
Пример #5
0
        // GET: MetingPoint/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MetingPoint metingPoint = db.MetingPoint.Find(id);

            if (metingPoint == null)
            {
                return(HttpNotFound());
            }
            return(View(metingPoint));
        }