BistroDriveWebApp.Controllers.ApiController.DishlistMethod C# (CSharp) Method

DishlistMethod() private method

private DishlistMethod ( JsonRequestBody json ) : JsonRespondBody
json JsonRequestBody
return JsonRespondBody
        private JsonRespondBody DishlistMethod(JsonRequestBody json)
        {
            aspnetuser user = DataManager.User.GetUserByToken(json.Token);
            if (user == null)
            {
                return new JsonRespondBody { Error = "Invalid token", Status = "error" };
            }
            if (json.Parameters.ContainsKey("username"))
            {
                user = DataManager.User.GetUserByName(json.Parameters["username"]);
                if (user == null)
                {
                    return new JsonRespondBody { Error = "Invalid username", Status = "error" };
                }
            }

            //генерация ответа
            List<DishSerealizerBody> reslist = GetDishList(user.Id);
            JsonRespondBody result = new JsonRespondBody
            {
                Result = reslist,
                Status = "OK"
            };
            return result;
        }