Пример #1
0
        public string PurchaseStatus(int id, int status, string body)
        {
            string    token     = TokenHelper.GetTokenJson(HttpContext.Request.Headers["Authorization"]);
            TokenInfo tokenInfo = JSONHelper.JSONToObject <TokenInfo>(token);
            User      p         = new User();

            p.Name = tokenInfo.UserName;
            User     user     = userService.getUserByName(p);
            Purchase purchase = JSONHelper.JSONToObject <Purchase>(body);

            purchase.Id         = id;
            purchase.OperatorId = user.Id;
            Purchase res = fixtureService.UpdatePurchaseStatus(purchase, status);

            if (res != null)
            {
                return(JSONHelper.ObjectToJSON(ResponseUtil.Ok(res)));
            }
            else
            {
                return(JSONHelper.ObjectToJSON(ResponseUtil.Fail()));
            }
        }