Example #1
0
 public void DeleteCity(CityModel City)
 {
     if (City == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         CITY current = data.CITY.Where(x => x.ID == City.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (UpdateException upx)
             {
                 throw new UpdateException(upx.InnerException.Message);
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }
Example #2
0
        public void DeleteEnterprise(LanguageModel language)
        {
            if (language == null)
            {
                throw new ArgumentNullException("language");
            }

            using (AppTourEntities data = new AppTourEntities())
            {
                LANGUAGE current = data.LANGUAGE.Where(p => p.ID == language.Id).SingleOrDefault();
                if (current != null)
                {
                    try
                    {
                        data.DeleteObject(current);
                        data.SaveChanges();
                    }
                    catch (UpdateException ex)
                    {
                        if (ex.InnerException != null)
                        {
                            throw new UpdateException(ex.InnerException.Message);
                        }
                        throw;
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
        }
Example #3
0
 public void DeleteApp(AppModel App)
 {
     if (App == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         APP current = data.APP.Where(p => p.ID == App.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }
Example #4
0
 public void DeleteEnterprise(EnterpriseModel enterprise)
 {
     if (enterprise == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         ENTERPRISE current = data.ENTERPRISE.Where(p => p.ID == enterprise.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (UpdateException ex)
             {
                 if (ex.InnerException != null)
                 {
                     throw new UpdateException(ex.InnerException.Message);
                 }
                 throw;
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }
Example #5
0
 public void DeleteCountry(CountryModel Country)
 {
     if (Country == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         COUNTRY current = data.COUNTRY.Where(x => x.ID == Country.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }
Example #6
0
 public void DeleteUser(UserModel user)
 {
     if (user == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         USER current = data.USER.Where(p => p.ID == user.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }
Example #7
0
 public void DeleteTopic(TopicModel topic)
 {
     if (topic == null)
     {
         throw new ArgumentNullException();
     }
     using (AppTourEntities data = new AppTourEntities())
     {
         TOPIC current = data.TOPIC.Where(p => p.ID == topic.Id).SingleOrDefault();
         if (current != null)
         {
             try
             {
                 data.DeleteObject(current);
                 data.SaveChanges();
             }
             catch (Exception e)
             {
                 if (e.InnerException != null)
                 {
                     throw new Exception(e.InnerException.Message);
                 }
                 throw;
             }
         }
     }
 }