//
 // GET: /Default/
 public ActionResult Index()
 {
     using (var db = new DomainContext())
     {
         var model = db.Facults.ListNames();
         return View(model);
     }
 }
Beispiel #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     using (var db = new DomainContext())
     {
         db.Lectors.Remove(id);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
 }
Beispiel #3
0
 public ActionResult Delete(int id)
 {
     using (var db = new DomainContext())
     {
         Lector lector = db.Lectors.Get(id);
         if (lector == null) return RedirectToAction("Error", "Default", new { id = 404 });
         return View(lector);
     }
 }
 public JsonResult GetGroups(string id)
 {
     int facultId;
     if (int.TryParse(id, out facultId))
         using (var db = new DomainContext())
         {
             var data = db.Groups.ByFacult(facultId);
             return Json(data);
         }
     return Json(null);
 }
Beispiel #5
0
 public JsonResult GetGroups(string id)
 {
     int facultId;
     if (int.TryParse(id, out facultId))
         using (var db = new DomainContext())
         {
             var data = db.Ajax.GroupsByFacult(facultId);
             return Json(data, JsonRequestBehavior.AllowGet);
         }
     return Json(null, JsonRequestBehavior.AllowGet);
 }
Beispiel #6
0
 public ActionResult AddFromTxt(TxtFile model)
 {
     if (ModelState.IsValid)
     {
         using (var db = new DomainContext())
         {
             var result = db.Auditories.AddListFromTxt(model.Txt);
             db.SaveChanges();
             ViewBag.Result = result;
             return View();
         }
     }
     return View(model);
 }
Beispiel #7
0
        public ActionResult Create(Lector lector)
        {
            if (ModelState.IsValid)
            {
                using (var db = new DomainContext())
                {
                    db.Lectors.Add(lector);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
            }

            return View(lector);
        }
Beispiel #8
0
 public ActionResult Edit(int id)
 {
     using (var db = new DomainContext())
     {
         Lector lector = db.Lectors.Get(id);
         return View(lector);
     }
 }
Beispiel #9
0
 public ActionResult Index(int page = 1)
 {
     using (var db = new DomainContext())
     {
         var model = db.Lectors.ListWithPager(page);
         if (!model.IsValid)
             return RedirectToAction("Error", "Default", new { id = 404 });
         return View(model);
     }
 }
Beispiel #10
0
 public JsonResult GetListByLetter(string letter)
 {
     using (var db= new DomainContext())
     {
         return Json(db.Ajax.ListAuditory(letter));
     }
 }