Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 public void RemovePerson(PersonDto person)
 {
     if (person == null) { throw new ArgumentNullException("person"); }
     this.RemovePerson(person.Id);
 }
Esempio n. 4
0
 public void CreateAbsence(PersonDto beneficiary, DateTime start, DateTime end, bool isPresent = false)
 {
     this.CreateAbsence(beneficiary.Id, start, end, isPresent);
 }
Esempio n. 5
0
        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();
            }
        }
Esempio n. 6
0
 private void Cancel()
 {
     this.Person = this.Service.GetPerson(this.Person.Id);
 }