public ActionResult EditMyProfile(user user, HttpPostedFileBase file) { var U = db.users.Single(u => u.id == user.id); try { if (file != null) { string filename = Path.GetFileName(file.FileName); string imePath = Path.Combine(Server.MapPath("~/images/"), filename); file.SaveAs(imePath); user.photo = imePath; } if (ModelState.IsValid) { U.job = user.job; U.fname = user.fname; U.lname = user.lname; U.email = user.email; U.mobile = user.mobile; db.SaveChanges(); ViewBag.Message = "Success"; return(RedirectToAction("newHomePage", "Home")); } return(View(user)); } catch { return(View(user)); } }
public ActionResult AddPost(post post) { if (ModelState.IsValid) { int id = Convert.ToInt32(Session["id"]); var writer = db.users.Where(model => model.id == id).FirstOrDefault(); post.state = 0; post.user_id = writer.id; db.posts.Add(post); db.SaveChanges(); return(RedirectToAction("newHomePage", "Home")); } return(View(post)); }
public void delete_member(int userid, int projectid) { var teams = db.teams.ToList().Where(t => t.project_id == projectid).Where(t => t.user_id == userid); int id = -1; foreach (var t in teams) { id = t.id; } if (id != -1) { var U = db.teams.Single(u => u.id == id); U.user_remove = 2; db.SaveChanges(); } }
// GET: Staff public ActionResult insert_qualification(int id, int type_id, int num1, int num2) { if (type_id == 2) { Models.PM pminstance = new Models.PM() { user_id = id, analytical = num1, highly_organized = num2 }; db.PMS.Add(pminstance); db.SaveChanges(); } else if (type_id == 3) { Models.TL tlinstance = new Models.TL() { user_id = id, decision_making = num1, excellent_communication = num2 }; db.TLs.Add(tlinstance); db.SaveChanges(); } else if (type_id == 4) { Models.JD jdinstance = new Models.JD() { user_id = id, coding_skills = num1, system_design = num2 }; db.JDs.Add(jdinstance); db.SaveChanges(); } return(View()); }
public ActionResult SetQualificationPM(PM P) { Project_ManagementEntities6 db = new Project_ManagementEntities6(); if (ModelState.IsValid) { P.user_id = Convert.ToInt32(Session["id"]); db.PMS.Add(P); db.SaveChanges(); return(RedirectToAction("../Home/newHomePage")); } return(View(P)); }
public ActionResult requestProject(requestProject p) { Project_ManagementEntities6 db = new Project_ManagementEntities6(); int pm_id = Convert.ToInt32(Session["type_user_id"]); if (ModelState.IsValid) { p.post_id = 10; p.PMs_id = pm_id; db.requestProjects.Add(p); db.SaveChanges(); return(View()); } return(View(p)); }
public ActionResult Approve(int id = 0) { post Post; if (id != 0) { Post = DB.posts.Find(id); if (Post == null) { return(HttpNotFound()); } Post.state = 1; DB.Entry(Post).State = EntityState.Modified; DB.SaveChanges(); return(RedirectToAction("AllPosts")); } else { return(RedirectToAction("AllPosts")); } }
public ActionResult sendRequestForJoining(int userid, int projectid) // in profile { Models.team tm = new Models.team() { user_id = userid, project_id = projectid, user_state = 1, user_remove = 0 }; db.teams.Add(tm); db.SaveChanges(); // it then should be remove the member that recieved the request from the ui return(View()); }