/// <summary> /// Creates the specified model. /// </summary> /// <param name="model">The model.</param> public void Create(Models.ProductOption model) { try { var productOption = _mapper.Map <ProductOption>(model); _dbContext.ProductOptions.Add(productOption); _dbContext.SaveChanges(); } catch (Exception ex) { // Log to technology specific error store _logging.Error(ex); // Bubble up exception. throw; }; }
/// <summary> /// Updates the specified model. /// </summary> /// <param name="model">The model.</param> public void Update(Models.ProductOption model) { try { using (var context = new DatabaseEntities()) { var productOption = _mapper.Map <ProductOption>(model); var original = _dbContext.ProductOptions.Find(productOption.Id); original.Name = productOption.Name; original.ProductId = productOption.ProductId; original.Description = productOption.Description; _dbContext.SaveChanges(); } } catch (Exception ex) { // Log to technology specific error store _logging.Error(ex); // Bubble up exception. throw; }; }