Ejemplo n.º 1
0
        public IActionResult ManageChildMenu(int?id)
        {
            DropDownFor_ManageChildMenu();
            US_CHILD_MENU _obj = new US_CHILD_MENU();

            if (id != null)
            {
                _obj = _unitOfWork.US_CHILD_MENU.Get(id.Value);
                if (_obj == null)
                {
                    TempData["msg"] = SweetMsg.SaveWarningOK();
                }
            }
            return(View(_obj));
        }
Ejemplo n.º 2
0
 public IActionResult ManageChildMenu(US_CHILD_MENU _obj)
 {
     if (ModelState.IsValid)
     {
         if (_obj.ID == 0)
         {
             _obj.ID        = _unitOfWork.US_CHILD_MENU.GetAll().Max(x => x.ID) + 1;
             _obj.IS_ACTIVE = true;
             _unitOfWork.US_CHILD_MENU.Add(_obj);
         }
         else
         {
             _unitOfWork.US_CHILD_MENU.Update(_obj);
         }
         _unitOfWork.Save();
         TempData["msg"] = SweetMsg.SaveSuccess();
         return(RedirectToAction(nameof(ManageChildMenu)));
     }
     TempData["msg"] = SweetMsg.SaveErrorOK();
     DropDownFor_ManageChildMenu();
     _obj.ID = 0;
     return(View(_obj));
 }