Beispiel #1
0
        }  //update project for all users

        public ActionResult DeleteProject(int projectToDelete)
        {
            if (Session["RoleID"] != null)
            {
                Projects project = new Projects();
                project = _projectMapper.MapProject(_projectBusinessLogic.GetProjectByProjectId(projectToDelete));
                if ((int)Session["UserId"] == project.User_ID || (int)Session["RoleID"] != 3)
                {
                    _projectBusinessLogic.DeleteProject(projectToDelete);
                    _houseController.AddPoints(-20, (int)Session["House_ID"]);
                    TempData["ProjectDeleted"] = "Project has been deleted successfully.";
                    return(RedirectToAction("ViewProjects", "Projects", new { area = "" }));
                }
                else
                {
                    ViewModel user = new ViewModel();
                    user.SingleUser = _userMapper.MapUser(_userBusinessLogic.GetUserByUserId(project.User_ID));
                    if (project.User_ID == user.SingleUser.User_ID)
                    {
                        _houseController.AddPoints(-20, user.SingleUser.House_ID);
                    }
                    _projectBusinessLogic.DeleteProject(projectToDelete);
                    TempData["ProjectDeleted"] = "Project has been deleted successfully.";
                    return(RedirectToAction("ViewProjects", "Projects", new { area = "" }));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Users", new { area = "" }));
            }
        } //delete project for user based on role or userId
Beispiel #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         ProjectsLogic.DeleteProject(id);
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "MoreHolidays/Projects/Delete",
             Parameters = "id=" + id
         });
     }
     return(RedirectToAction("Index"));
 }