/// <summary> /// Creates the specified model. /// </summary> /// <param name="model">The model.</param> public void Create(Models.Product model) { try { var product = _mapper.Map <Product>(model); _dbContext.Products.Add(product); _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.Product model) { try { var product = _mapper.Map <Product>(model); var original = _dbContext.Products.Find(product.Id); original.Name = product.Name; original.Price = product.Price; original.DeliveryPrice = product.DeliveryPrice; original.Description = product.Description; _dbContext.SaveChanges(); } catch (Exception ex) { // Log to technology specific error store _logging.Error(ex); // Bubble up exception. throw; }; }