// GET: Project/Deliver/5 public ActionResult Deliver(int id) { int pm_id = int.Parse(Session["user_id"].ToString()); pm_project project = db.pm_project.Find(id); if (project == null) { return(HttpNotFound()); } //update state project.p_state = 0; //skill obj var skills_found = db.pm_personSkill.Where(s => s.project_manger_id == pm_id).FirstOrDefault(); if (skills_found == null) { pm_personSkill pm_skill = new pm_personSkill(); pm_skill.project_manger_id = pm_id; pm_skill.skill = "Projects"; pm_skill.ps_level = 1; db.pm_personSkill.Add(pm_skill); } else { //inc skilss skills_found.ps_level += skills_found.ps_level; } db.SaveChanges(); return(RedirectToAction("Current")); }
public ActionResult Create(pm_project project)//, HttpPostedFileBase upload { try { /* string path = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName); * * upload.SaveAs(path); * project.p_description = upload.FileName;*/ //project.p_description = upload.FileName; // TODO: Add insert logic here //save the id of the user to table project.customer_id = int.Parse(Session["user_id"].ToString()); project.admin_approved = 0; project.p_state = 1; db.pm_project.Add(project); db.SaveChanges(); ModelState.Clear(); ViewBag.Msg = "Project Added successfully!"; return(View()); } catch { ViewBag.Msg = "Can't add project"; return(View()); } }
public ActionResult Edit(pm_project editedProject) { try { // TODO: Add update logic here if (editedProject != null) { var project = db.pm_project.Find(editedProject.id); project.title = editedProject.title; project.p_description = editedProject.p_description; //project.price = editedProject.price; //project.start_date = editedProject.start_date; //project.end_date = editedProject.end_date; db.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }
// GET: Project/Delete/5 public ActionResult Delete(int id) { pm_project project = db.pm_project.Find(id); if (project == null) { return(HttpNotFound()); } return(View(project)); }
public ActionResult Delete(pm_project projectDeleted) { try { // TODO: Add delete logic here var project = db.pm_project.Find(projectDeleted.id); db.pm_project.Remove(project); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Project/Leave/5 public ActionResult Leave(int id) { int project_manager_id = int.Parse(Session["user_id"].ToString()); pm_project project = db.pm_project.Find(id); project.project_manger_id = null; db.SaveChanges(); //delete the project manager from team var project_team_req = db.pm_projectTeam.Where(req => req.project_id == id && req.member_id == project_manager_id); db.pm_projectTeam.RemoveRange(project_team_req); if (project == null) { return(HttpNotFound()); } return(RedirectToAction("Current")); }
public ActionResult Manage(pm_project editedProject) { try { // TODO: Add update logic here if (editedProject != null) { var project = db.pm_project.Find(editedProject.id); project.start_date = editedProject.start_date; project.end_date = editedProject.end_date; project.price = editedProject.price; ViewBag.Msg = "Schedule successfully added "; db.SaveChanges(); } return(RedirectToAction("Current")); } catch { ViewBag.Msg = "Error! "; return(RedirectToAction("Current")); } }