public bool deletepost(int id) { internship_post post = DB.internship_post.Where(x => x.Id == id).FirstOrDefault(); DB.internship_post.Remove(post); int count = DB.SaveChanges(); return(count > 0 ? true : false); }
public void applyOnPost(string selectedoption, int idperson) { Person p = DB.People.Where(X => X.IDperson == idperson).FirstOrDefault(); internship_post ip = DB.internship_post.Where(X => X.Title == selectedoption).FirstOrDefault(); applied_post ap = new applied_post(); ap.internship_post = ip; ap.Person = p; DB.applied_post.Add(ap); DB.SaveChanges(); }
public ActionResult EditPOST(FormCollection form) { int id = int.Parse(form["ID"]); internship_post currentpost = _resumeRepository.GetPostById(id); Session["mytitle"] = currentpost.Title; Session["mydesc"] = currentpost.Description; Session["myendtime"] = currentpost.End_time; Session["edit"] = true; Session["myid"] = currentpost.Id; return(RedirectToAction("CreatePost")); }
public bool addpost(string title, string des, string endtime, string admin) { internship_post post = new internship_post(); post.Description = des; post.End_time = endtime; post.Title = title; post.Post_time = DateTime.Now.ToShortDateString(); DB.UserPassword.Where(X => X.username == admin).FirstOrDefault().internship_post.Add(post); int count = DB.SaveChanges(); return(count > 0 ? true : false); }