Exemplo n.º 1
0
 public ActionResult DeleteConfirm(int id)
 {
     if (id == 2)
     {
         studentRepository.Delete(id);
         userRepository.Delete(id);
         TempData["Deleted"] = "User deleted";
     }
     if (id == 3)
     {
         judgeRepository.Delete(id);
         userRepository.Delete(id);
         TempData["Deleted"] = "User deleted";
     }
     if (id == 4)
     {
         organizationRepository.Delete(id);
         userRepository.Delete(id);
         TempData["Deleted"] = "User deleted";
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 2
0
        public ActionResult DeleteConfirm(int id)
        {
            User user = userRepository.Get(id);

            if (user.AccountType_Id == 2)
            {
                studentRepository.Delete(id);
                userRepository.Delete(id);
            }
            else if (user.AccountType_Id == 3)
            {
                judgeRepository.Delete(id);
                userRepository.Delete(id);
                TempData["Deleted"] = "User deleted";
            }
            else if (user.AccountType_Id == 4)
            {
                organizationRepository.Delete(id);
                userRepository.Delete(id);
                TempData["Deleted"] = "User deleted";
            }

            return(RedirectToAction("Index"));
        }