Ejemplo n.º 1
0
        // GET: Students/Details/5
        public ActionResult Details(int?id)
        {
            CustomLogger = new CustomLogger();
            if (id == null)
            {
                CustomLogger.ExceptionLogFunction(HttpStatusCode.BadRequest + "");
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Students students = db.Students.Find(id);
            Students students = (from u in db.Students where u.ID == id select u).Include(u => u.Class).First();

            if (students == null)
            {
                return(HttpNotFound());
            }
            return(View(students));
        }
Ejemplo n.º 2
0
        // GET: Students/Edit/5
        public ActionResult Edit(int?id)

        {
            context = new ApplicationDbContext();
            var             UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context));
            ApplicationUser currentUser = UserManager.FindById(User.Identity.GetUserId());

            if (id == null)
            {
                CustomLogger.ExceptionLogFunction(HttpStatusCode.BadRequest + "");
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Students students = db.Students.Find(id);

            if (students == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClassName = new SelectList(db.Classes.Where(o => o.UserId == currentUser.Id), "ClassId", "ClassName", students.ClassName);
            return(View(students));
        }