public async Task <IActionResult> Edit([Bind("Examsl,Studentid,Examname,Institution,Board,Result")] Examresult examresult)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(examresult);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ExamresultExists(examresult.Examsl, examresult.Studentid))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["Studentid"] = new SelectList(_context.Student, "Id", "Id", examresult.Studentid);
     return(View(examresult));
 }
        public async Task <IActionResult> Create([Bind("Examsl,Studentid,Examname,Institution,Board,Result")] Examresult examresult)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(examresult);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                ViewData["Studentid"] = new SelectList(_context.Student, "Id", "Id", examresult.Studentid);
                return(View(examresult));
            }
            catch (DbUpdateException dbx)
            {
                ViewData["err"] = "Inserted Exam Serial No. is already exists";
                return(View());
            }
            catch (Exception ex)
            {
                ViewData["err"] = ex.Message.ToString();
                return(View());
            }
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Examresult examresult = db.Examresults.Find(id);

            db.Examresults.Remove(examresult);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public ActionResult Edit(Examresult examresult)
 {
     if (ModelState.IsValid)
     {
         db.Entry(examresult).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID);
     return(View(examresult));
 }
Exemple #5
0
        public ActionResult Create(Examresult examresult)
        {
            if (ModelState.IsValid)
            {
                db.Examresults.Add(examresult);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID);
            return(View(examresult));
        }
Exemple #6
0
        // GET: Examresult/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Examresult examresult = db.Examresults.Find(id);

            if (examresult == null)
            {
                return(HttpNotFound());
            }
            return(View(examresult));
        }
Exemple #7
0
        // GET: Examresult/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Examresult examresult = db.Examresults.Find(id);

            if (examresult == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentName", examresult.StudentID);
            return(View(examresult));
        }