Exemplo n.º 1
0
        public JsonResult FacebookLoginMobileApi()
        {
            var response = new ResponseModel<LoginResponse>();
            String fid = Request.QueryString["fid"];
            String access_token = Request.QueryString["accessToken"];            
            try
            {                
                response = new SocialAuthService().CheckAndSaveFacebookUserInfoIntoDatabase(fid, Constants.NA,access_token,true);                
            }
            catch (DbEntityValidationException e)
            {
                DbContextException.LogDbContextException(e);
                response.Status = 500;
                response.Message = "Failed";
            }

            return Json(response, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        public JsonResult userMapping()
        {
            var response = new ResponseModel<LoginResponse>();

            String fid = Request.QueryString["fid"];
            String refKey = Request.QueryString["refKey"];
            var headers = new HeaderManager(Request);
            if (headers.AuthToken != null)
            {
                M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
                var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
                if (isValidToken)
                {
                    var facebookUserMap = _db.FacebookAuths.SingleOrDefault(x => x.facebookId == fid);
                    facebookUserMap.username = session.UserName;
                    try
                    {
                        _db.SaveChanges();
                        response.Status = 209;
                        response.Message = "success-";
                    }
                    catch (DbEntityValidationException e)
                    {
                        DbContextException.LogDbContextException(e);
                        response.Status = 500;
                        response.Message = "Failed";
                    }
                }
            }
            else
            {
                //TODO:need to call method socialauthservice
                response = new SocialAuthService().CheckAndSaveFacebookUserInfoIntoDatabase(fid, refKey,Constants.NA,false);
            }
            
            return Json(response, JsonRequestBehavior.AllowGet);
        }