public ActionResult <string> DeleteOrder([FromBody] OrderDeleteModel odModel) { System.Console.WriteLine("hellow??asdfasdfasfdasf"); Customer customerOut; bool sdfs = _authenticator.InnerValidate(odModel.token, out customerOut); if (sdfs == true) { System.Console.WriteLine("token: " + customerOut.CustomerToken); System.Console.WriteLine("log orderModel:"); System.Console.WriteLine(odModel); if (_orderLogic.DeleteStackFromOrder(customerOut, odModel)) { return(JsonConvert.SerializeObject(customerOut, new Newtonsoft.Json.JsonSerializerSettings() { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore })); } else { return(StatusCode(401)); } } return(StatusCode(401)); }
/// <summary> /// delete the stack in the model from the order of the customer /// </summary> /// <param name="customerOut"></param> /// <param name="odModel"></param> public bool DeleteStackFromOrder(Customer customer, OrderDeleteModel odModel) { bool success = false; if (odModel.removedStacks != null) { foreach (var stack in odModel.removedStacks) { if (!_toyRepository.RemoveSellableStackFromOrder(customer.CurrentOrder, stack)) { return(false); } else { success = true; } } } return(success); }
public HttpResponseMessage Delete(OrderDeleteModel orderDeleteModel) { this.orderAppService.DeleteExistingOrder(orderDeleteModel.Id); return(new HttpResponseMessage(HttpStatusCode.OK)); }