Пример #1
0
        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");
        }
Пример #2
0
        public ActionResult Update(OrderView entity)
        {
            IList<OrderView> entityList = new List<OrderView>();
            entityList.Add(entity);

            return UpdateBatch(entityList);
        }
Пример #3
0
 public ActionResult Create()
 {
     ViewData["ORDER_ADD_OR_EDIT"] = "A";
     var model = new OrderView();
     return PartialView("OrderForm", model);
 }
Пример #4
0
        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;
            }
        }