public ActionResult Create(Channel channel) { ModelState.Clear(); channel.UserId = WebSecurity.GetUserId(User.Identity.Name); TryValidateModel(channel); if (ModelState.IsValid) { Context.Channels.Add(channel); Context.SaveChanges(); return Roles.IsUserInRole(UserRole.Admin) ? RedirectToAction("Index") : RedirectToAction("IndexMy", "Broadcasts"); } return View(channel); }
public ActionResult Edit(Channel channel) { if (ModelState.IsValid) { Context.Entry(channel).State = EntityState.Modified; Context.SaveChanges(); return RedirectToAction("Index"); } return View(channel); }