Example #1
0
 public void Create(Brand item)
 {
     try
     {
         _yapartStoreContext.Brands.Add(item);
         _yapartStoreContext.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Create(Category item)
 {
     try
     {
         _yapartStoreContext.Categories.Add(item);
         _yapartStoreContext.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public void Create(Product item)
 {
     try
     {
         _yapartStoreContext.Products.Add(item);
         _yapartStoreContext.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public void ChangeNameForLink()
        {
            var nullModificationsUrl = _yapartStoreContext.Modifications;

            if (nullModificationsUrl.Any())
            {
                foreach (var modification in nullModificationsUrl)
                {
                    modification.Url = modification.Name
                                       .Trim()
                                       .Replace("/", "")
                                       .Replace("рестайлинг", "restyling")
                                       .Replace(" ", "-")
                                       .ToLower();
                    _yapartStoreContext.Entry(modification).State = EntityState.Modified;
                }
                _yapartStoreContext.SaveChanges();
            }
        }
Example #5
0
 public void Save()
 {
     _yapartStoreContext.SaveChanges();
 }