public Brand CreateBrand(Brand brand) { if (string.IsNullOrEmpty(brand.SpeakerBrand)) { throw new InvalidDataException("Can not create a brand without a name"); } return(_brandRepository.CreateBrand(brand)); }
public async Task <IActionResult> Create([Bind("Id,Name")] BrandVM brand) { if (ModelState.IsValid && !String.IsNullOrEmpty(brand.Name) && await _brandRepository.CreateBrand(_mapper.Map <BrandModel>(brand))) { return(base.RedirectToAction(nameof(Index))); } return(View(brand)); }
public IActionResult CreateBrand(BrandViewModel model) { if (ModelState.IsValid) { var brand = brandRepository.CreateBrand(model); if (brand > 0) { return(RedirectToAction("ShowBrands", "Admin")); } } return(View()); }
public bool AddBrand(Brand brand) { return(_brandRepository.CreateBrand(brand)); }
public string CreateBrand(Brand brand) { return(_brandRepository.CreateBrand(brand)); }
public async Task <BrandDto> CreateBrand(BrandDto brandCreateDto) { BrandDto newBrand = await _brandRepo.CreateBrand(brandCreateDto); return(newBrand); }