BistroDriveWebApp.Controllers.ApiController.ProfileMethod C# (CSharp) Метод

ProfileMethod() приватный Метод

private ProfileMethod ( JsonRequestBody json ) : JsonRespondBody
json JsonRequestBody
Результат JsonRespondBody
        private JsonRespondBody ProfileMethod(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" };
                }
            }

            //генерация ответа
            UserSerealizerBody ub = GetUserInfo(user.Id);
            JsonRespondBody result = new JsonRespondBody
            {
                Result = ub,
                Status = "OK"
            };
            return result;
        }