public ActionResult Add(int id, int VolunteeringContact, decimal? VolunteerNos, FormCollection collection) { try { // TODO: Add insert logic here var vol = new Volunteering(); vol.PremiseID = id; vol.VolunteeringContact = VolunteeringContact; vol.VolunteerNos = VolunteerNos; vol.VolunteeringPurpose = collection["VolunteeringPurpose"]; vol.VolunteeringDetail = collection["VolunteeringDetail"]; vol.StartDate = _db.ConvertDate(collection["StartDate"], "dd/MM/yyyy"); vol.EndDate = _db.ConvertDate(collection["EndDate"], "dd/MM/yyyy"); vol.VolunteeringIsActive = 1; _db.Insert(vol); ViewBag.Alert = "true"; ViewBag.Message = "Action success!"; ViewBag.URL = "/Premise/Amend/" + id + "#tabs-6"; return View("../Shared/Redirect"); //return Redirect("/Premise/Amend"+id+"#tabs-2"); } catch { return View("../Shared/Error"); } }
//insert public void Insert(Volunteering volunteering) { _db.Volunteerings.InsertOnSubmit(volunteering); _db.SubmitChanges(); }
partial void DeleteVolunteering(Volunteering instance);
partial void UpdateVolunteering(Volunteering instance);
partial void InsertVolunteering(Volunteering instance);
private void detach_Volunteerings(Volunteering entity) { this.SendPropertyChanging(); entity.Contact = null; }
private void attach_Volunteerings(Volunteering entity) { this.SendPropertyChanging(); entity.Premise = this; }