Пример #1
0
        public ActionResult Delete(string id, IFormCollection collection)
        {
            try
            {
                User userToDelete = _userBl.GetById(id);
                try
                {
                    _userBl.DeleteUser(userToDelete);
                }
                catch
                {
                    return(RedirectToAction("Index", "Error", new { error = string.Format("Could not find user with id {0}", id) }));
                }

                return(RedirectToAction("Details", "User"));
            }
            catch
            {
                return(RedirectToAction("Index", "Error", new { error = string.Format("Oops! failed to delete product with id {0}", id) }));
            }
        }