Пример #1
0
 public ActionResult Create(Navigation pNewNavigation,string Lang)
 {
     try
     {
         // TODO: Add insert logic here
         if (Lang == "Tiếng Việt")
         {
             pNewNavigation.LangId = 0;
         }
         else
         {
             pNewNavigation.LangId = 1;
         }
         pNewNavigation.CreatedBy = account.Id;
         pNewNavigation.CreatedDate = DateTime.Now;
         pNewNavigation.EditBy = account.Id;
         pNewNavigation.EditDate = DateTime.Now;
         pNewNavigation.IsActive = true;
         var check = new NavigationModel().Create(pNewNavigation);
         if (!check)
         {
             return View(pNewNavigation);
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View(pNewNavigation);
     }
 }
Пример #2
0
 public bool Create(Navigation pNewNavigation)
 {
     try
     {
         _db.Navigations.Add(pNewNavigation);
         _db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #3
0
 public bool Edit(int pId,Navigation pNewNavigation)
 {
     try
     {
         var Object = _db.Navigations.Find(pId);
         Object.Name = pNewNavigation.Name;
         Object.Code = pNewNavigation.Code;
         Object.Icon = pNewNavigation.Icon;
         Object.Link = pNewNavigation.Link;
         Object.OrderDisplay = pNewNavigation.OrderDisplay;
         Object.CreatedBy = pNewNavigation.CreatedBy;
         Object.CreatedDate = pNewNavigation.CreatedDate;
         Object.EditBy = pNewNavigation.EditBy;
         Object.EditDate = pNewNavigation.EditDate;
         Object.IsActive = pNewNavigation.IsActive;
         Object.LangId = pNewNavigation.LangId;
         _db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #4
0
 public ActionResult Edit(int id, Navigation pNewNavigation, string Lang)
 {
     try
     {
         // TODO: Add update logic here
         if (Lang == "Tiếng Việt")
         {
             pNewNavigation.LangId = 0;
         }
         else
         {
             pNewNavigation.LangId = 1;
         }
         pNewNavigation.CreatedBy = account.Id;
         pNewNavigation.CreatedDate = DateTime.Now;
         pNewNavigation.EditBy = account.Id;
         pNewNavigation.EditDate = DateTime.Now;
         var check = new NavigationModel().Edit(id, pNewNavigation);
         if (!check)
         {
             return View(pNewNavigation);
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View(new NavigationModel().GetNavigationById(id));
     }
 }