public ProductView CreateAndGetProduct(FoodFactsProduct newProduct) { ProductView productView; try { var product = newProduct.Adapt <tbl_Products>(); product.CreatedDate = DateTime.Now; int productID = db.SaveProduct(product); productView = db.GetProduct <ProductView>(productID); } catch (Exception e) { throw e; } return(productView); }
public bool CreateProduct(FoodFactsProduct newProduct) { bool success; try { var product = newProduct.Adapt <tbl_Products>(); product.CreatedDate = DateTime.Now; db.SaveProduct(product); success = true; } catch (Exception e) { throw e; } return(success); }