public ActionResult AddOrder(int id, [FromBody] Order order) { if (order != null) { order.Date = _currentDate.GetDate(); order.TotalPrice = 100; try { var addResult = _orderMenager.AddOrder(id, order); } catch (Exception error) { return(BadRequest(error.Message)); } return(Ok("Purchase Successfull!")); } else { return(BadRequest("No order provided!")); } }
public ActionResult UpdateProduct([FromBody] FullProduct product) { if (product != null) { product.productDetails.DatePublished = _currentDate.GetDate(); var Succesfull = _productMenager.UpdateProduct(product.product, product.productDetails); if (Succesfull) { return(Ok("Product succesfully updated!")); } else { return(BadRequest("Product is not valid")); } } else { return(BadRequest("Product was not provided!")); } }