Ejemplo n.º 1
0
 public static bool SaveState(StateCreateViewModel model)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = new State()
             {
                 Name        = model.Name,
                 StateCode   = model.StateCode,
                 CountryID   = model.CountryID,
                 IsActive    = true,
                 CreatedBy   = model.CreatedBy,
                 CreatedDate = DateTime.UtcNow
             };
             context.States.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public static bool SaveCountry(CountryCreateViewModel model)
 {
     try
     {
         var data = new Country()
         {
             Name         = model.Name,
             CurrencyName = model.CurrencyName,
             CurrencyCode = model.CurrencyCode,
             Code         = model.Code,
             IsActive     = model.IsActive,
             CreatedBy    = model.CreatedBy,
             CreatedDate  = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.Countries.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public static long SaveBusiness(BusinessCreateViewModel model)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = new Business()
             {
                 BusinessName         = model.BusinessName,
                 BusinessType         = model.BusinessType,
                 CategoryID           = model.CategoryID,
                 CategoryName         = model.CategoryName,
                 CreatedBy            = model.CreatedBy,
                 CreatedDate          = DateTime.UtcNow,
                 DataSourceName       = model.DataSourceName,
                 EmailID              = model.EmailID,
                 IncorporationDate    = model.IncorporationDate,
                 YearOfIncorporation  = model.YearOfIncorporation,
                 NoOfEmployees        = model.NoOfEmployees,
                 RegisteredCountry    = model.RegisteredCountry,
                 RegisteredCountryID  = model.RegisteredCountryID,
                 RegisteredProvince   = model.RegisteredProvince,
                 RegisteredProvinceID = model.RegisteredProvinceID,
                 RegistrationNumber   = model.RegistrationNumber,
                 Status  = model.Status,
                 Tags    = model.Tags,
                 Website = model.Website
             };
             context.Businesses.Add(data);
             context.SaveChanges();
             return(data.ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
 public static bool SaveBusinessType(BusinessTypeCreateViewModel model)
 {
     try
     {
         var data = new BusinessType()
         {
             TypeName    = model.TypeName,
             TypeCode    = model.TypeCode,
             IsActive    = true,
             CreatedBy   = model.CreatedBy,
             CreatedDate = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.BusinessTypes.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
 public static bool SaveCategory(CategoryCreateViewModel model)
 {
     try
     {
         var data = new Category()
         {
             Name        = model.Name,
             ParentID    = model.ParentID,
             IsActive    = true,
             CreatedBy   = model.CreatedBy,
             CreatedDate = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.Categories.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }