public ActionResult DeleteConfirmed(int id) { SubGroupTypes subGroupTypes = db.SubGroupTypes.Find(id); db.SubGroupTypes.Remove(subGroupTypes); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,GroupsId")] SubGroupTypes subGroupTypes) { if (ModelState.IsValid) { db.Entry(subGroupTypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GroupsId = new SelectList(db.Groups, "Id", "Name", subGroupTypes.GroupsId); return(View(subGroupTypes)); }
// GET: SubGroupTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubGroupTypes subGroupTypes = db.SubGroupTypes.Find(id); if (subGroupTypes == null) { return(HttpNotFound()); } return(View(subGroupTypes)); }
// GET: SubGroupTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubGroupTypes subGroupTypes = db.SubGroupTypes.Find(id); if (subGroupTypes == null) { return(HttpNotFound()); } ViewBag.GroupsId = new SelectList(db.Groups, "Id", "Name", subGroupTypes.GroupsId); return(View(subGroupTypes)); }
public ActionResult Create([Bind(Include = "Id,Name,GroupsId")] SubGroupTypes subGroupTypes) { if (ModelState.IsValid) { db.SubGroupTypes.Add(subGroupTypes); db.SaveChanges(); return(RedirectToAction("Index")); } List <Schools> list = new List <Schools>(); var user = User.Identity.GetUserId(); list = (from b in db.Schools where b.AspNetUsersId.Equals(user) select b).ToList(); ViewBag.GroupsId = new SelectList(db.Groups.Where(s => s.SchoolsId == list.First().Id).ToList(), "Id", "Name", subGroupTypes.GroupsId); return(View(subGroupTypes)); }