コード例 #1
0
ファイル: Manufacturer.cs プロジェクト: happyhacker/Phorcys
        public virtual bool Equals(Manufacturer obj)
        {
            if (obj == null) return false;

              if (Equals(Id, obj.Id) == false)
            return false;

              return true;
        }
コード例 #2
0
 public void Delete(Manufacturer manufacturer)
 {
     try
     {
         ManufacturerRepository.Delete(manufacturer);
         ManufacturerRepository.DbContext.CommitChanges();
     }
     catch (Exception e)
     {
         log.Error("Cound not delete manufacturer. Something else probably references this manufacturer",e);
         throw e;
     }
     return;
 }
コード例 #3
0
        public Manufacturer Save(Manufacturer manufacturer)
        {
            try
            {
                //manufacturer.LastModifed = System.DateTime.Now;

                ManufacturerRepository.SaveOrUpdate(manufacturer);
                ManufacturerRepository.DbContext.CommitChanges();
            }
            catch (Exception e)
            {
                log.Error("Unable to save manufacturer ", e);
                throw e;
            }
            return manufacturer;
        }
コード例 #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);
              }
        }