Beispiel #1
0
        public string ScrapStatus(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);
            Scrap scrap = JSONHelper.JSONToObject <Scrap>(body);

            scrap.Id         = id;
            scrap.OperatorId = user.Id;
            Scrap res = fixtureService.UpdateScrapStatus(scrap, status);

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