private DataPerson GetDataPerson(PeopleEntities context, string lastName) { DataPerson foundPerson = null; foundPerson = (from p in context.DataPersons where p.LastName == lastName select p).FirstOrDefault(); return(foundPerson); }
private Person GetPersonFromDataPerson(DataPerson dataPerson) { var person = new Person() { FirstName = dataPerson.FirstName, LastName = dataPerson.LastName, StartDate = dataPerson.StartDate.Value, Rating = dataPerson.Rating.Value, }; return(person); }
public void AddPerson(Person newPerson) { using (var context = new PeopleEntities()) { if (GetDataPerson(context, newPerson.LastName) != null) return; var person = new DataPerson() { FirstName = newPerson.FirstName, LastName = newPerson.LastName, StartDate = newPerson.StartDate, Rating = newPerson.Rating, }; context.DataPersons.Add(person); context.SaveChanges(); } }
public void AddPerson(Person newPerson) { using (var context = new PeopleEntities()) { if (GetDataPerson(context, newPerson.LastName) != null) { return; } var person = new DataPerson() { FirstName = newPerson.FirstName, LastName = newPerson.LastName, StartDate = newPerson.StartDate, Rating = newPerson.Rating, }; context.DataPersons.Add(person); context.SaveChanges(); } }
private Person GetPersonFromDataPerson(DataPerson dataPerson) { throw new NotImplementedException(); }
private Person GetPersonFromDataPerson(DataPerson dataPerson) { var person = new Person() { FirstName = dataPerson.FirstName, LastName = dataPerson.LastName, StartDate = dataPerson.StartDate.Value, Rating = dataPerson.Rating.Value, }; return person; }