// // GET: /Account/Details/5 public ActionResult LoadCategory(string pass) { if (String.IsNullOrEmpty(pass) || pass != "Federo@1357//Edimburgo@2017") { return RedirectToAction("Lista", "Articulos", null); } CategoryModel model = new CategoryModel(); return View(model); }
public ActionResult LoadCategory(CategoryModel model) { if (catRepository.GetByName(model.Name) != null) { return RedirectToAction("LoadCategory", "Federo@1357//Edimburgo@2017"); } catRepository.Save(model); return RedirectToRoute("/Account/LoadArticle?pass=Federo@1357//Edimburgo@2017"); }
public void Save(CategoryModel model) { dbContext.Categories.Add(model); dbContext.SaveChanges(); }