public Response <User> Login(string email, string password, bool remember = false)
        {
            if (_netService.IsConnected())
            {
                //Si hay conexion
                var response = _proxyService.Login(email, password);

                if (response.IsSuccess)
                {
                    response.Result.IsRemember = remember;
                    return(_dataService.Insert(response.Result));
                }
                else
                {
                    return(response);
                }
            }
            else
            {
                //Si no hay conexion
                var user = _dataService.GetFirst <User>();
                if (user != null)
                {
                    if (user.Email.ToUpper() == email && user.Password.ToUpper() == password)
                    {
                        return new Response <User>
                               {
                                   IsSuccess = true,
                                   Result    = user
                               }
                    }
                    ;
                    else
                    {
                        return(new Response <User>
                        {
                            IsSuccess = false,
                            Message = "No hay conexion a internet y un usuario nunca se logueo"
                        });
                    }
                }
                else
                {
                    return(new Response <User>
                    {
                        IsSuccess = false,
                        Message = "No hay conexion a internet y un usuario nunca se logueo"
                    });
                }
            }
        }
Exemple #2
0
 public void Update(RememberModel model)
 {
     if (_netService.IsConnected())
     {
         //TODO : ejecutar remoto
     }
     _rememberRepository.Update(model.RememberData);
 }