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

            if (mst_RoleMap == null)
            {
                return(HttpNotFound());
            }
            return(View(mst_RoleMap));
        }
Пример #2
0
 public ActionResult Edit(int id, Mst_RoleMap mst_RoleMap)
 {
     try
     {
         // TODO: Add update logic here
         if (ModelState.IsValid)
         {
             db.Entry(mst_RoleMap).State = EntityState.Modified;
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #3
0
        public ActionResult Delete(int id)
        {
            try
            {
                Mst_RoleMap mst_RoleMap = db.Mst_RoleMaps.Find(id);
                db.Mst_RoleMaps.Remove(mst_RoleMap);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.message = "Delete failed. Please check if record is used by another table.";
                Mst_RoleMap mst_RoleMap2 = db.Mst_RoleMaps.Find(id);
                return(View(mst_RoleMap2));
            }
        }
Пример #4
0
        public ActionResult Create(Mst_RoleMap mst_RoleMap)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    db.Mst_RoleMaps.Add(mst_RoleMap);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }