Exemplo n.º 1
0
        public ContentResult GetUserInfo(string login)
        {
            try
            {
                var loginString = string.IsNullOrWhiteSpace(login) ? AuthenticationManager.GetPrincipalNameFromCookie(HttpContext) : login;
                var userDb      = UserBusinessLogic.GetUserByLogin(loginString);
                var userModel   = new UserDataModel(userDb);

                return(Content(JsonConvert.SerializeObject(userModel), "application/json"));
                //return Json(JsonConvert.SerializeObject(userModel, new JsonSerializerSettings { DateFormatString = "dd.MM.yyyy" }), "application/json" ,JsonRequestBehavior.AllowGet);
            }
            catch (Exception e)
            {
                return(Content(e.Message));
                //return Json(e.Message, JsonRequestBehavior.AllowGet);
            }
        }