public PersonModel(PersonDto dto, bool isSelected = false) { this.Id = dto.Id; this.IsEducator = dto.IsEducator; this.IsSelected = false; this.Name = dto.Name; this.Surname = dto.Surname; this.Person = dto; this.IsTrainee = dto.IsTrainee; }
public void UpdatePerson(PersonDto person) { using (var db = new DataContext()) { var e = db.People.Find(person.Id); e.Name = person.Name; e.Surname = person.Surname; e.IsTrainee = person.IsTrainee; e.IsEducator = person.IsEducator; db.SaveChanges(); } }
public void RemovePerson(PersonDto person) { if (person == null) { throw new ArgumentNullException("person"); } this.RemovePerson(person.Id); }
public void CreateAbsence(PersonDto beneficiary, DateTime start, DateTime end, bool isPresent = false) { this.CreateAbsence(beneficiary.Id, start, end, isPresent); }
public void CreatePerson(PersonDto person) { if (person == null) { throw new ArgumentNullException("person"); } using (var db = new DataContext()) { if (person.Surname == null) { person.Surname = string.Empty; } var entity = person.ToEntity(); db.People.Add(entity); db.SaveChanges(); } }
private void Cancel() { this.Person = this.Service.GetPerson(this.Person.Id); }