Beispiel #1
0
        public void Create(Brand brand)
        {
            brandRepository.Add(brand);
            brandRepository.SaveChange();

            urlSlugService.Add(brand.SeoTitle, brand.Id, BrandEntityName);
            brandRepository.SaveChange();
        }
Beispiel #2
0
        public IActionResult Create([FromBody] BrandForm model)
        {
            if (ModelState.IsValid)
            {
                var brand = new Brand
                {
                    Name = model.Name,
                    SeoTitle = StringHelper.ToUrlFriendly(model.Name),
                    IsPublished = model.IsPublished
                };

                brandService.Create(brand);

                return Ok();
            }
            return new BadRequestObjectResult(ModelState);
        }
Beispiel #3
0
 public void Update(Brand brand)
 {
     urlSlugService.Update(brand.SeoTitle, brand.Id, BrandEntityName);
     brandRepository.SaveChange();
 }
Beispiel #4
0
 public void Delete(Brand brand)
 {
     brand.IsDeleted = true;
     urlSlugService.Remove(brand.Id, BrandEntityName);
     brandRepository.SaveChange();
 }