// POST api/<controller> public async Task <IHttpActionResult> Post([FromBody] Order order) { if (order == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await _getOrders.PlaceOrder(order); if (order.IsPaid) { return(Ok(true)); } OrderDetails orderDetails = await _getOrders.GetOrder(order.OrderId); List <OrderDetails> ordersDetails = await _getOrders.GetAllOrders(); await NewOrderHub.NewOrder(true, ordersDetails); await EditOrderHub.EditOrder(orderDetails); return(Ok(true)); } catch (Exception) { return(Ok(false)); } }
// POST api/<controller> public async Task <IHttpActionResult> Post([FromBody] Order order) { if (order == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!await _userService.CheckUserStatus(order.UserId)) { return(Ok(BlockedUser(true, null))); } await _getOrders.PlaceOrder(order); OrderDetails orderDetails = await _getOrders.GetOrder(order.OrderId); List <OrderDetails> ordersDetails = await _getOrders.GetAllOrders(); await NewOrderHub.NewOrder(false, ordersDetails); return(Ok(BlockedUser(false, orderDetails))); }