Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LOAIUSER type = db.LOAIUSERs.Find(id);

            db.LOAIUSERs.Remove(type);
            db.SaveChanges();
            return(RedirectToAction("List"));
        }
Beispiel #2
0
 public ActionResult Edit(LOAIUSER type)
 {
     if (ModelState.IsValid)
     {
         db.Entry(type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("List"));
     }
     return(View(type));
 }
Beispiel #3
0
        public ActionResult Create(LOAIUSER type)
        {
            if (ModelState.IsValid)
            {
                db.LOAIUSERs.Add(type);
                db.SaveChanges();
                return(RedirectToAction("List"));
            }

            return(View(type));
        }
Beispiel #4
0
        public ActionResult Edit(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                LOAIUSER type = db.LOAIUSERs.Find(id);

                if (type == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
                return(View(type));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        public ActionResult Delete(int?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                LOAIUSER type = db.LOAIUSERs.Find(id);

                if (type == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
                ViewBag.LoaiUser = new SelectList(db.LOAIUSERs, "MaloaiUser", "TenloaiUser");
                return(View(type));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }