public Section CreateSectionFromSectionModel(SectionModel model)
 {
     Section temp = new Section();
     temp.email = model.email;
     temp.id = model.id;
     temp.locality = model.locality;
     temp.name = model.name;
     temp.phone_number = model.phone_number;
     temp.post = model.post;
     temp.postal_code = model.postal_code;
     temp.short_name = model.short_name;
     temp.street = model.street;
     return temp;
 }
        private void FixupSection(Section previousValue)
        {
            if (previousValue != null && previousValue.People.Contains(this))
            {
                previousValue.People.Remove(this);
            }

            if (Section != null)
            {
                if (!Section.People.Contains(this))
                {
                    Section.People.Add(this);
                }
                if (id_section != Section.id)
                {
                    id_section = Section.id;
                }
            }
        }
 public SectionModel CreateSectionModelFromSection(Section section)
 {
     SectionModel temp = new SectionModel();
     temp.email = section.email;
     temp.id = section.id;
     temp.locality = section.locality;
     temp.name = section.name;
     temp.phone_number = section.phone_number;
     temp.post = section.post;
     temp.postal_code = section.postal_code;
     temp.short_name = section.short_name;
     temp.street = section.street;
     return temp;
 }
 public void UpdateSection(ref Section section, SectionModel model)
 {
     section.email = model.email;
     section.id = model.id;
     section.locality = model.locality;
     section.name = model.name;
     section.phone_number = model.phone_number;
     section.post = model.post;
     section.postal_code = model.postal_code;
     section.short_name = model.short_name;
     section.street = model.street;
 }
 public ActionResult Delete(DeleteObjectByName model)
 {
     try
     {
         Section sec = new Section() { short_name = model.Name };
         sectionRepository.DeleteObject(sec);
         return RedirectToAction("Index");
     }
     catch (DbUpdateException ex)
     {
         throw new DbUpdateException("Wystąpił błąd podczas usuwania sekcji. Aby usunąć sekcję należy usunąć z niej wszystkich pracowników", ex.InnerException);
     }
     catch (Exception ex)
     {
         throw new Exception("Wystąpił błąd podczas usuwania sekcji. Proszę skontaktować się z administratorem", ex.InnerException);
     }
 }