//public IEnumerable<Person> getPersons([FromBody]SearchParams param) public IEnumerable <Person> getPersons(string searchString) { IEnumerable <Person> ret = null; searchString = JsonConvert.DeserializeObject <string>(searchString); //searchString = searchString.Replace('\\\',''); try { using (var db = new PeopleDB()) { ret = db.GetPersonsBySearch(searchString) .Select(p => new Person { FirstName = p.FirstName, LastName = p.LastName, Age = p.Age, Address = p.Address, Interests = p.Interests, Picture = p.Picture }) .ToList(); return(ret); } } catch (Exception ex) { throw ex; } }
private void Awake() { //if there are any other instances of PeopleDB in a scene, destroy them and make this the only one if (instance == null) { instance = this; } else if (instance != null) { Destroy(gameObject); } //begin reading people from the XML sheet ReadItemsFromDatabase(); //debug tools -- turn every person in the newly made dictionary into a Person class for (int i = 0; i < peopleDictionaries.Count; i++) { people.Add(new Person(peopleDictionaries[i])); foreach (Person person in people) { } } //make this database persist throughout the game DontDestroyOnLoad(gameObject); }
public PeopleRepository(PeopleDB context, PurchasesDB contextPurchases, SendEmailsDB contextSendEmails, SendTextMessagesDB contextSendTextMessages) { _context = context; _contextPurchases = contextPurchases; _contextSendEmails = contextSendEmails; _contextSendTextMessages = contextSendTextMessages; }
public IActionResult EditPerson(Person p) { var db = new PeopleDB(_connectionString); db.EditPerson(p); return(Json(p)); }
public IActionResult DeletePerson(int id) { var db = new PeopleDB(_connectionString); db.DeletePerson(id); return(Json(id)); }
public IActionResult GetPeople() { var db = new PeopleDB(_connectionString); var ppl = db.GetPeople(); return(Json(ppl)); }
public LanguagesRepository(LanguagesDB context, AccusationsDB contextAccusations, ComplementsDB contextComplements, FarewellsDB contextFarewells, GreetingsDB contextGreetings, InvitationsOffersDB contextInvitationsOffers, PeopleDB contextPeople, RequestsForActionDB contextRequestsForAction, RequestsForInformationDB contextRequestsForInformation) { _context = context; _contextAccusations = contextAccusations; _contextComplements = contextComplements; _contextFarewells = contextFarewells; _contextGreetings = contextGreetings; _contextInvitationsOffers = contextInvitationsOffers; _contextPeople = contextPeople; _contextRequestsForAction = contextRequestsForAction; _contextRequestsForInformation = contextRequestsForInformation; }
public IActionResult Index() { PeopleDB db = new PeopleDB(_connectionString); PersonViewModel vm = new PersonViewModel { people = db.GetPeople() }; if (TempData["message"] != null) { vm.Message = (string)TempData["message"]; } return(View(vm)); }
public ActionResult UpdatePerson(int id, string region) { try { // 수정할 데이터를 선택합니다. var peopleDB = new PeopleDB(); var willUpdate = peopleDB.People.Single(x => x.Id == id); // 수정합니다. willUpdate.Region = region; peopleDB.SubmitChanges(); return(Content("UPDATE SUCCESS")); } catch (Exception exception) { return(HttpNotFound()); } }
public ActionResult DeletePerson(int id) { try { // 삭제할 데이터를 선택합니다. var peopleDB = new PeopleDB(); var willDelete = peopleDB.People.Single(x => x.Id == id); // 삭제합니다. peopleDB.People.DeleteOnSubmit(willDelete); peopleDB.SubmitChanges(); return(Content("DELETE SUCCESS")); } catch (Exception excception) { return(HttpNotFound()); } }
public ActionResult InsertPerson(string name, string gender, string region, string bloodType) { // 테이블에 입력할 데이터를 만듭니다. var willAdd = new People(); willAdd.Name = name; willAdd.Gender = gender; willAdd.Region = region; willAdd.BloodType = bloodType; try { // 테이블에 데이터를 집어넣습니다. var peopleDB = new PeopleDB(); peopleDB.People.InsertOnSubmit(willAdd); peopleDB.SubmitChanges(); return(Content("INSERT SUCCESS")); } catch (Exception exception) { // 데이터 입력에 실패할 경우 return(HttpNotFound()); } }
public void TestInit() { this.sut = new PeopleDB(new Person(123456789, "Gosho"), new Person(987654321, "Pesho")); }
public ActionResult GetPeopleJSON() { var peopleDB = new PeopleDB(); return(Json(peopleDB.People, JsonRequestBehavior.AllowGet)); }