public ActionResult Create([Bind(Include = "Id,Name,Order")] VideoCatGroup videoCatGroup) { if (ModelState.IsValid) { videoCatGroup.UniqueTitle = VITV.Web.Helpers.UrlHelper.URLFriendly(videoCatGroup.Name); _catGroupRepository.InsertOrUpdate(videoCatGroup); _catGroupRepository.Save(); return(RedirectToAction("Index")); } return(View(videoCatGroup)); }
public void InsertOrUpdate(VideoCatGroup videoCatGroup) { if (videoCatGroup.Id == default(int)) { // New entity _context.VideoCatGroups.Add(videoCatGroup); } else { // Existing entity _context.Entry(videoCatGroup).State = EntityState.Modified; } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VideoCatGroup videoCatGroup = _catGroupRepository.Find(id.Value); if (videoCatGroup == null) { return(HttpNotFound()); } return(View(videoCatGroup)); }