Esempio n. 1
0
 public void Delete(DiveAgency agency)
 {
     try {
     DiveAgencyRepository.Delete(agency);
     DiveAgencyRepository.DbContext.CommitChanges();
       } catch (Exception e) {
     log.Error("Cound not delete dive agency. Something else probably references this agency", e);
     throw e;
       }
       return;
 }
Esempio n. 2
0
        public virtual bool Equals(DiveAgency obj)
        {
            if (obj == null) return false;

              /*if (Equals(DiveAgencyId, obj.DiveAgencyId) == false)
            return false;
              */
              if (Equals(Notes, obj.Notes) == false)
            return false;

              return true;
        }
Esempio n. 3
0
        public DiveAgency Save(DiveAgency agency)
        {
            try {
            //agency.LastModifed = System.DateTime.Now;

            DiveAgencyRepository.SaveOrUpdate(agency);
            DiveAgencyRepository.DbContext.CommitChanges();
              } catch (Exception e) {
            log.Error("Unable to save dive agency ", e);
            throw e;
              }
              return agency;
        }
Esempio n. 4
0
        private void saveNewContact(ContactModel model)
        {
            this.user = userServices.FindUser(this.User.Identity.Name);
              Contact contact = new Contact();
              contact = UpdateContactFromModel(contact, model);
              contact.User = this.user;
              contact.Created = DateTime.Now;
              contact.LastModified = DateTime.Now;
              contactServices.Save(contact);

              if (model.isDiver) {
            Diver diver = new Diver();
            diver.Contact = contact;
            diverServices.Save(diver);
              }
              if (model.isInstructor) {
            Instructor instructor = new Instructor();
            instructor.Contact = contact;
            instructorServices.Save(instructor);
              }

              if (model.isAgency) {
            DiveAgency agency = new DiveAgency();
            agency.Contact = contact;
            diveAgencyServices.Save(agency);
              }

              if (model.isManufacturer) {
            Manufacturer manufacturer = new Manufacturer();
            manufacturer.Contact = contact;
            manufacturerServices.Save(manufacturer);
              }

              if (model.isDiveShop)
              {
            DiveShop diveShop = new DiveShop();
            diveShop.Contact = contact;
            diveShopServices.Save(diveShop);
              }
        }