public ActionResult Details(int id) { var repo = new Repositories.PersonRepository(); var person = repo.GetPerson(id); return(View(person)); }
public ActionResult Edit(Person person) { var repo = new Repositories.PersonRepository(); repo.UpdatePerson(person); return(RedirectToAction("Details", new { id = person.PersonID })); }
public ActionResult Delete(int id) { var repo = new Repositories.PersonRepository(); repo.DeletePerson(id); return(RedirectToAction("People")); }
public ActionResult People() { ViewBag.Message = "Your people page."; var repo = new Repositories.PersonRepository(); var people = repo.GetPeople(); return(View(people)); }
public ActionResult Create(Models.Person newPerson) { if (ModelState.IsValid) { var repo = new Repositories.PersonRepository(); repo.CreatePerson(newPerson); return(RedirectToAction("Details", new { id = newPerson.PersonID })); } else { return(View(newPerson)); } }
public IEnumerable <Models.Person> GetContacts( string search = null, string personType = null, int?ely = null, int?subRegion = null, int?county = null, int?greaterArea = null, int?administrativeCourt = null, int?municipality = null) { Queries.PersonQuery query = new Queries.PersonQuery(); query.SearchKeyword = search; query.ElyIs = ely; query.SubRegionIs = subRegion; query.CountyIs = county; query.GreaterAreaIs = greaterArea; query.AdministrativeCourtIs = administrativeCourt; query.MunicipalityIs = municipality; if (personType == null) { personType = "any"; } string[] personTypes = ( from p in personType.Split(',') select p.Trim().ToLower()).ToArray(); query.PersonTypes = personTypes; string connStr = ConfigurationManager .ConnectionStrings["urbanPlanningDB"].ToString(); using (DbConnection db = new SqlConnection(connStr)) { db.Open(); var repository = new Repositories.PersonRepository(db); return((List <Models.Person>)repository.FindAll(query)); } }