Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SubGroupTypes subGroupTypes = db.SubGroupTypes.Find(id);

            db.SubGroupTypes.Remove(subGroupTypes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 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));
 }
Example #3
0
        // 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));
        }
Example #4
0
        // 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));
        }
Example #5
0
        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));
        }