Exemplo n.º 1
0
        public ActionResult ReverseOrder(int mainPayId)
        {
            Response res = new Response();

            res.Successed = true;
            if (ModelState.IsValid)
            {
                try
                {
                    var             currentUser = OperatorProvider.Provider.GetCurrent();
                    ReverseOrderDTO req         = new ReverseOrderDTO()
                    {
                        MainPayId       = mainPayId,
                        UserId          = currentUser.UserId,
                        CompanyId       = currentUser.CompanyId.ToInt(),
                        CurrentMarketId = currentUser.LoginMarketId,
                        UserCode        = currentUser.UserCode
                    };
                    res.Data = _checkOutService.ReverseOrder(req);
                }
                catch (Exception ex)
                {
                    res.Successed = false;
                    res.Message   = ex.Message;
                }
            }
            else
            {
                res.Data    = null;
                res.Message = string.Join(",", ModelState
                                          .SelectMany(ms => ms.Value.Errors)
                                          .Select(e => e.ErrorMessage));
            }
            return(Json(res));
        }