public Order Add(Order order) { try { var ob = new OrderBusiness(); return(ob.Create(order)); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, Content = new StringContent(ex.Message + ". Excepción interna: " + ex.InnerException), }; throw new HttpResponseException(httpError); } }
public ActionResult Create(FormCollection collection) { try { OrderEntity orderEntity = new OrderEntity(); orderEntity.RecipientName = collection["RecipientName"]; orderEntity.DeliveryStreet = collection["DeliveryStreet"]; orderEntity.DeliveryCity = collection["DeliveryCity"]; orderEntity.DeliveryState = collection["DeliveryState"]; orderEntity.DeliveryPostalCode = collection["DeliveryPostalCode"]; orderEntity.Phone = collection["Phone"]; orderEntity.Email = collection["Email"]; OrderBusiness orderbusiness = new OrderBusiness(); orderbusiness.Create(orderEntity); return(RedirectToAction("Index")); } catch (Exception ex) { CreateViewModel model = new CreateViewModel(); model.Error = ex.Message; return(View(model)); } }
public ActionResult Create(FormCollection collection) { try { OrderEntity orderEntity = new OrderEntity(); orderEntity.RecipientName = collection["RecipientName"]; orderEntity.DeliveryStreet = collection["DeliveryStreet"]; orderEntity.DeliveryCity = collection["DeliveryCity"]; orderEntity.DeliveryState = collection["DeliveryState"]; orderEntity.DeliveryPostalCode = collection["DeliveryPostalCode"]; orderEntity.Phone = collection["Phone"]; orderEntity.Email = collection["Email"]; OrderBusiness orderbusiness = new OrderBusiness(); orderbusiness.Create(orderEntity); return RedirectToAction("Index"); } catch(Exception ex) { CreateViewModel model = new CreateViewModel(); model.Error = ex.Message; return View(model); } }
public Order Create(Order order) { return(business.Create(order)); }