Example #1
0
 public ActionResult Delete(DeleteStudentViewModel student)
 {
     if (!UserIsInRole("Admin"))
     {
         return(RedirectToAction("Index", "Home"));
     }
     _studentCommand.Handle(new StudentInputDelete {
         StudentId = student.Id
     });
     return(RedirectToAction("Index"));
 }
Example #2
0
        // GET: Student/Delete/5
        public ActionResult Delete(Guid id)
        {
            if (!UserIsInRole("Admin"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            var result = _studentQuery.Handle(new StudentInputGetById {
                StudentId = id
            });
            var student = new DeleteStudentViewModel
            {
                Id        = result.Student.Id,
                FirstName = result.Student.FirstName
            };

            return(View(student));
        }