public ActionResult Save(OrderView entity) { HttpClient httpClient = HttpClientHelper.Create(base.ApiUrl); var jsonValue = JsonSerializer.SerializeToString<OrderView>(entity); string result = httpClient.Insert(jsonValue); return RedirectToAction("List", "Order"); }
public ActionResult Update(OrderView entity) { IList<OrderView> entityList = new List<OrderView>(); entityList.Add(entity); return UpdateBatch(entityList); }
public ActionResult Create() { ViewData["ORDER_ADD_OR_EDIT"] = "A"; var model = new OrderView(); return PartialView("OrderForm", model); }
public HttpResponseMessage Insert(OrderView entity) { try { AutoMapper.Mapper.CreateMap<OrderView, Order>(); Order p = AutoMapper.Mapper.Map<OrderView, Order>(entity); OrderServiceInstance.Insert<Order, EPOrder>(p); var response = Request.CreateResponse<OrderView>(HttpStatusCode.Created, entity, "application/json"); return response; } catch (System.Exception ex) { //记录异常日志信息 var errorHandler = ErrorHandlerFactory.Create("插入产品信息发生异常!", 1003); LogHelper.Error(errorHandler.GetInfo(), ex); //throw new WebFaultException<ErrorHandler>(errorHandler, HttpStatusCode.BadRequest); throw ex; } }