Exemplo n.º 1
0
        private void HailWithUserInfo(UserModel User, DriverModel driver)
        {
            RequestModel req = new RequestModel();

            Models.User user = new Models.User();

            Driver d = new Driver();

            req.Key = "00";

            user.Name     = User.Name;
            user.Phone    = User.Phone;
            user.Rating   = User.Rating.ToString();
            user.Image    = User.Image.ToString();
            user.Key      = User.Key;
            user.Location = userlocation;

            req.User = user;

            req.Type   = "User";
            req.Status = "Pending";


            req.Date = DateTime.Today.ToShortDateString();


            d.Name     = driver.Name;
            d.Key      = driver.Key;
            d.Phone    = driver.Phone;
            d.Rating   = driver.Rating.ToString();
            d.Location = driver.Location;
            d.Image    = driver.Image;
            d.Vehicle  = driver.Vehicle;

            req.Driver = d;

            if (req.User.Key != null)
            {
                _firebaseDatabase.SetRequest(req.Driver.Key, req);
                requestModel = req;
                ListenRequest(req);
            }
        }