public ActionResult ConfirmDelete(string id) { string query = "select * from VolunteerPostings where VolunteerPostingID=@id"; SqlParameter param = new SqlParameter("@id", id); VolunteerPosting volunteerposting = db.VolunteerPostings.SqlQuery(query, param).FirstOrDefault(); return(View(volunteerposting)); }
public ActionResult Update(int id) { string query = "select * from VolunteerPostings where VolunteerPostingID= @id"; var parameter = new SqlParameter("@id", id); VolunteerPosting volunteerposting = db.VolunteerPostings.SqlQuery(query, parameter).FirstOrDefault(); return(View(volunteerposting)); }
public ActionResult Show(string id) { //find data about the individual volunteer posting string main_query = "Select * from VolunteerPostings where VolunteerPostingID = @id"; var pk_parameter = new SqlParameter("@id", id); VolunteerPosting VolunteerPosting = db.VolunteerPostings.SqlQuery(main_query, pk_parameter).FirstOrDefault(); return(View(VolunteerPosting)); }
public ActionResult Add(string VolunteerPostingDate, string VolunteerPostingTitle, string VolunteerPostingDescription) { VolunteerPosting newposting = new VolunteerPosting(); //https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings Debug.WriteLine(VolunteerPostingDate); newposting.VolunteerPostingDate = Convert.ToDateTime(VolunteerPostingDate); newposting.VolunteerPostingTitle = VolunteerPostingTitle; newposting.VolunteerPostingDescription = VolunteerPostingDescription; //first add posting db.VolunteerPostings.Add(newposting); db.SaveChanges(); return(RedirectToAction("List")); }