public ActionResult Edit(int id, EducationCountry model) { try { var country = _context.EducationCountries.First(ea => ea.Id == id); country.Title = model.Title ?? ""; country.TitleEn = model.TitleEn ?? ""; country.Name = model.Name.UpdatePageWebName(); country.SortOrder = model.SortOrder; _context.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(EducationCountry model) { try { var country = new EducationCountry { Title = model.Title ?? "", TitleEn = model.TitleEn ?? "", Name = model.Name.UpdatePageWebName(), SortOrder = model.SortOrder }; _context.EducationCountries.Add(country); _context.SaveChanges(); return RedirectToAction("Index"); } catch (Exception ex) { return View(); } }