예제 #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);
        }
예제 #2
0
        public UpdateBrandResponse EditBrand(UpdateBrandRequest updateBrandRequest)
        {
            UpdateBrandResponse updateBrandResponse = null;

            if (updateBrandRequest.Id == updateBrandRequest.Brand.Id)
            {
                var brand = _messageMapper.MapToBrand(updateBrandRequest.Brand);
                _brandRepository.UpdateBrand(brand);
                var brandDto = _messageMapper.MapToBrandDto(brand);

                updateBrandResponse = new UpdateBrandResponse
                {
                };
            }
            return(updateBrandResponse);
        }
예제 #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);
        }
예제 #4
0
        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);
        }