/// <summary> /// /// </summary> /// <param name="productOptionDto"></param> /// <returns></returns> public async Task <int> AddProductOption(ProductOptionDto productOptionDto) { ProductOption existingProductOption = productOptionRepository.GetById(productOptionDto.Id); if (existingProductOption != null) { throw new HttpResponseException { Status = 500, Value = $"Product Option with the same id {productOptionDto.Id} already exists" } } ; return(await productOptionRepository.AddOrUpdateAsync(new ProductOption { Id = productOptionDto.Id, ProductId = productOptionDto.ProductId, Name = productOptionDto.Name, Description = productOptionDto.Description }, true)); }