Ejemplo n.º 1
0
 public ActionResult DeleteConfirmed(string id)
 {
     try
     {
         var      userService = new UsersServices();
         UsersDto user        = userService.GetOne(id);
         userService.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         ViewBag.Error = e.Message;
         return(View("Delete"));
     }
 }
Ejemplo n.º 2
0
        public ActionResult Delete(int Id)
        {
            SessionKontrol();
            if (_users != null)
            {
                _UsersServices.Delete(Id);

                _unitOfWork.SaveChanges();
                return(RedirectToAction("UserList", "User"));
            }

            else
            {
                return(RedirectToAction("Index", "Login"));
            }
        }
        public bool DeleteUser(string login)
        {
            try
            {
                UsersServices userService = new UsersServices();
                User          user        = userService.GetByUserName(login);
                userService.Delete(user.Id);
                userService.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
Ejemplo n.º 4
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     if (GetAuthorization(_userService.GetById(id)))
     {
         try
         {
             _userService.Delete(id);
             _userService.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch
         {
             InitializeViews(id);
             return(RedirectToAction("Index"));
         }
     }
     else
     {
         return(RedirectToLogOn());
     }
 }