Beispiel #1
0
        public SpecificationValueDto Create(SpecificationValueDto specificationValueDto)
        {
            if (!IsAuthorized())
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            var specificationValue = specificationValueDto.CreateModel();

            this._unitOfWork.SpecificationValues.Add(specificationValue);
            this._unitOfWork.Complete();

            return(new SpecificationValueDto(specificationValue));
        }
Beispiel #2
0
        public SpecificationValueDto Delete(SpecificationValueDto specificationValueDto)
        {
            if (!IsAuthorized())
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            var specificationValue = this._unitOfWork.SpecificationValues.SingleOrDefault(s => s.ProductSpecificationID == specificationValueDto.SpecificationID && s.Value == specificationValueDto.Value);

            if (specificationValue == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            this._unitOfWork.SpecificationValues.Remove(specificationValue);
            this._unitOfWork.Complete();

            return(new SpecificationValueDto(specificationValue));
        }