public string SaveProduct(string productname, string productdescription) { try { var product = new Product(); product.ProductName = productname; product.ProductDescription = productdescription; product.ProductStatus = (int)HelpDeskEnums.Status.Active; product.DateCreated = DateTime.Now; _productRepository.SaveProduct(product); // TODO: Move response message to the constants file return "Saved Product - Success"; } catch (Exception e) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } }
public void SaveProduct(Product product) { _context.Products.Add(product); _context.SaveChanges(); }