public void GetById() { var products = _productLibrary.Get(Guid.Parse("8F2E9176-35EE-4F0A-AE55-83023D2DB1A3"), null); var product = _products.Find(x => x.Id == Guid.Parse("8F2E9176-35EE-4F0A-AE55-83023D2DB1A3")); Assert.AreEqual(products.First().Id, product.Id); Assert.AreEqual(products.First().Name, product.Name); Assert.AreEqual(products.First().Description, product.Description); Assert.AreEqual(products.First().DeliveryPrice, product.DeliveryPrice); Assert.AreEqual(products.First().Price, product.Price); }
public IHttpActionResult GetProduct(Guid id) { try { var result = _productLibrary.Get(id, null); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message + ex.InnerException?.Message + ex.InnerException?.StackTrace)); } }
public async Task <IActionResult> Details(long?id) { if (id == null) { return(NotFound()); } var product = await _productLibrary.Get((long)id); if (product == null) { return(NotFound()); } return(View(product)); }