Example #1
0
        public CreateBrandResponse SaveBrand(CreateBrandRequest createBrandRequest)
        {
            var brand = messageMapper.MapToBrand(createBrandRequest.Brand);

            brandRepository.SaveBrand(brand);
            var createbrandresponse = new CreateBrandResponse {
                Brand = messageMapper.MapToBrandDto(brand)
            };

            return(createbrandresponse);
        }
Example #2
0
        public DeleteBrandResponse DeleteBrand(DeleteBrandRequest deleteBrandRequest)
        {
            var brand = _brandRepository.FindBrandById(deleteBrandRequest.Id);

            _brandRepository.DeleteBrand(brand);
            var brandDto = _messageMapper.MapToBrandDto(brand);

            return(new DeleteBrandResponse
            {
                Brand = brandDto
            });
        }
Example #3
0
        public CreateBrandResponse SaveBrand(CreateBrandRequest brandRequest)
        {
            var createBrandResponse = new CreateBrandResponse();
            var brand = _messageMapper.MapToBrand(brandRequest.brand);

            try
            {
                _brandRepository.SaveBrand(brand);
                var brandDto = _messageMapper.MapToBrandDto(brand);
                createBrandResponse.Brand = brandDto;
                createBrandResponse.Messages.Add(item: "Successfully saved the Brand");
                createBrandResponse.StatusCode = System.Net.HttpStatusCode.Created;
            }
            catch (Exception e)
            {
                var error = e.ToString();
                createBrandResponse.Messages.Add(error);
                createBrandResponse.StatusCode = System.Net.HttpStatusCode.InternalServerError;
            }

            return(createBrandResponse);
        }
        public CreateBrandResponse SaveBrand(CreateBrandRequest parBrandRequest)
        {
            var varBrand = _MessageMapper.MapToBrand(parBrandRequest.locBrandDTO);

            _BrandRepository.Save();
            var varBrandDTO = _MessageMapper.MapToBrandDto(varBrand);

            CreateBrandResponse locCreateBrandResponse = new CreateBrandResponse
            {
                locBrandDTO = varBrandDTO
            };

            return(locCreateBrandResponse);
        }