예제 #1
0
        public JsonResult InsertMainMenu(tblMainMenu tblMainMenu)
        {
            var result = new Result();

            result = _adminService.InsertMainMenu(tblMainMenu);
            return(Json(result));
        }
예제 #2
0
        public bool AddMainMenu(MainMenuVM _mainMenu)
        {
            try
            {
                if (HttpContext.Current.Session["User"] != null)
                {
                    var user = (LoginVM)HttpContext.Current.Session["User"];

                    var mm = new tblMainMenu();
                    mm.MenuName     = _mainMenu.MenuName;
                    mm.isActive     = _mainMenu.isActive;
                    mm.IconClass    = _mainMenu.IconClass;
                    mm.CreatedDate  = System.DateTime.Now;
                    mm.ModifiedDate = System.DateTime.Now;
                    mm.CreatedBy    = user.RoleId;
                    mm.ModifiedBy   = user.RoleId;
                    _mainMenuResp.Add(mm);
                    _unitOfWork.Complete();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e) { return(false); }
        }
예제 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblMainMenu tblMainMenu = db.tblMainMenu.Find(id);

            db.tblMainMenu.Remove(tblMainMenu);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #4
0
 public ActionResult Edit([Bind(Include = "Id,MainMenu")] tblMainMenu tblMainMenu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblMainMenu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblMainMenu));
 }
예제 #5
0
        public ActionResult Create([Bind(Include = "Id,MainMenu")] tblMainMenu tblMainMenu)
        {
            if (ModelState.IsValid)
            {
                db.tblMainMenu.Add(tblMainMenu);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblMainMenu));
        }
 public bool InsertMainMenu(tblMainMenu tblMainMenu)
 {
     try
     {
         _entity.tblMainMenu.Add(tblMainMenu);
         _entity.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(true);
 }
 public Result InsertMainMenu(tblMainMenu tblMainMenu)
 {
     try
     {
         return(adminManager.InsertMainMenu(tblMainMenu));
     }
     catch (Exception ex)
     {
         return(new Result {
             IsSuccess = false, Message = ex.Message
         });
     }
 }
예제 #8
0
        // GET: MainMenus/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblMainMenu tblMainMenu = db.tblMainMenu.Find(id);

            if (tblMainMenu == null)
            {
                return(HttpNotFound());
            }
            return(View(tblMainMenu));
        }
        public Result InsertMainMenu(tblMainMenu tblMainMenu)
        {
            try
            {
                IAdmin iAdmin = new WCMS_DAL_Admin();
                using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, ApplicationState.TransactionOptions))
                {
                    Result _Result = new Result();
                    _Result.IsSuccess = iAdmin.InsertMainMenu(tblMainMenu);

                    if (_Result.IsSuccess)
                    {
                        transaction.Complete();
                    }
                    return(_Result);
                }
            }
            catch (Exception ex) { throw ex; }
        }