public ManufacturerDto CreateManufacturer(ManufacturerDto manufacturerDto) { manufacturerDto.Slug = _slugService.CreateSlug(manufacturerDto.Name); var manufacturerToInsert = _mapper.Map <ManufacturerEntity>(manufacturerDto); var manufacturer = _manufacturerRepository.Insert(manufacturerToInsert); return(_mapper.Map <ManufacturerDto>(manufacturer)); }
/// <summary> /// Inserts a manufacturer /// </summary> /// <param name="manufacturer">Manufacturer</param> public virtual void InsertManufacturer(Manufacturer manufacturer) { if (manufacturer == null) { throw new ArgumentNullException("manufacturer"); } _manufacturerRepository.Insert(manufacturer); //cache _cacheManager.GetCache(CACHE_NAME_MANUFACTURERS).Clear(); _cacheManager.GetCache(CACHE_NAME_PRODUCTMANUFACTURERS).Clear(); //event notification //_eventPublisher.EntityInserted(manufacturer); }
/// <summary> /// Method whose purpose is to insert a /// new Manufacturer record. /// </summary> /// <param name="manufacturer"> /// Newly created ManufacturerModel object. /// </param> /// <returns> /// Returns true if the query is successfully executed /// otherwise returns false. /// </returns> public bool Insert(ManufacturerModel manufacturer) { return(_manufacturerRepository.Insert(manufacturer) > 0 ? true : false); }