public ContractDetailsViewModel(ContractItem contractItem)
        {
            this.Item     = contractItem;
            PayCommand    = new DelegateCommand(OnPay, CanPay);
            StartCommand  = new DelegateCommand(OnStart);
            FinishCommand = new DelegateCommand(OnFinish);
            CallCommand   = new DelegateCommand(OnCall);
            SmsCommand    = new DelegateCommand(OnSms);

            Init();
        }
        public async void Init()
        {
            CheckUser();
            if (!LocalStorage.IsExist)
            {
                await UserDialogs.Instance.AlertAsync("Please login to continue", "Mech Login", "Ok");

                return;
            }

            IsRefreshing = true;

            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    var client = new HttpClient();

                    var response = await client.GetAsync(EndPoint);

                    if (response.IsSuccessStatusCode)
                    {
                        var content = await response.Content.ReadAsStringAsync();

                        var list = JsonConvert.DeserializeObject <List <Contract> >(content);

                        if (list != null)
                        {
                            Contracts.Clear();
                        }

                        foreach (var contract in list)
                        {
                            if (contract.Mechanic != null)
                            {
                                var contractitem = new ContractItem()
                                {
                                    Id             = contract.Id,
                                    Time           = contract.Time,
                                    IsConfirmed    = contract.PaidByCustomer,
                                    Name           = contract.Mechanic.Name,
                                    Title          = contract.Mechanic.Title,
                                    InitialCharges = contract.InitialCharges,
                                    RatePerKM      = contract.RatePerKM,
                                    RatePerHour    = contract.RatePerHour,
                                    KM             = contract.KM,
                                    ContactNo      = contract.Mechanic.ContactNo,
                                    IsWorkStarted  = contract.IsWorkStarted,
                                    WorkStarted    = contract.WorkStarted,
                                    IsWorkFinished = contract.IsWorkFinished,
                                    WorkFinished   = contract.WorkFinished
                                };
                                Contracts.Add(contractitem);
                            }
                            else if (contract.Customer != null)
                            {
                                var contractitem = new ContractItem()
                                {
                                    Id             = contract.Id,
                                    Time           = contract.Time,
                                    IsConfirmed    = contract.RecievedByMehanic,
                                    Name           = contract.Customer.Name,
                                    Title          = $"{contract.Customer.Vehicle} {contract.Customer.Model}",
                                    InitialCharges = contract.InitialCharges,
                                    RatePerKM      = contract.RatePerKM,
                                    RatePerHour    = contract.RatePerHour,
                                    KM             = contract.KM,
                                    ContactNo      = contract.Customer.ContactNo,
                                    IsWorkStarted  = contract.IsWorkStarted,
                                    WorkStarted    = contract.WorkStarted,
                                    IsWorkFinished = contract.IsWorkFinished,
                                    WorkFinished   = contract.WorkFinished
                                };
                                Contracts.Add(contractitem);
                            }
                        }
                    }
                    IsRefreshing = false;
                }
            }
            catch (Exception ex)
            {
                IsRefreshing = false;
            }

            IsRefreshing = false;
        }