public IHttpActionResult GetAllGarages()
        {
            GaragesListRsponseModel model = new GaragesListRsponseModel();

            try
            {
                var garages = _db.Garages.AsQueryable();
                garages = garages.Where(b => b.IsActive == true);


                foreach (var item in garages.ToList())
                {
                    GarageModel gModel = new GarageModel();
                    gModel.GarageId       = item.GarageId;
                    gModel.Garage_Name    = item.Garage_Name;
                    gModel.Garage_Address = item.Garage_Address;
                    gModel.OpenTime       = item.OpenTime;
                    gModel.Latitute       = item.Latitute;
                    gModel.Longitude      = item.Longitude;

                    if (item.OpenTime.HasValue)
                    {
                        DateTime opentime = DateTime.Today.Add(item.OpenTime.Value);
                        gModel.OpenTimeStr = opentime.ToString("hh:mm tt");
                    }
                    gModel.CloseTime = item.CloseTime;
                    DateTime closetime = DateTime.Today.Add(item.CloseTime);
                    gModel.CloseTimeStr = closetime.ToString("hh:mm tt");

                    gModel.ServiceDays = item.ServiceDays;
                    if (item.City1 != null)
                    {
                        gModel.City = item.City1.CityName;
                    }
                    if (item.State1 != null)
                    {
                        gModel.State = item.State1.StateName;
                    }
                    gModel.Pincode = item.Pincode;
                    gModel.CityID  = item.City1.Id;
                    gModel.StateID = item.State1.Id;
                    model.Garages.Add(gModel);
                }
                model.Result = true;
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            if (model != null)
            {
                return(Ok(model));
            }
            else
            {
                return(NotFound());
            }
        }
        public GaragesListRsponseModel GetGaragesByCity(int Id)
        {
            GaragesListRsponseModel model = new GaragesListRsponseModel();

            try
            {
                var garages = _db.Garages.AsQueryable();
                garages = garages.Where(b => b.IsActive == true);
                garages = garages.Where(b => b.City == Id);

                foreach (var item in garages.ToList())
                {
                    GarageModel gModel = new GarageModel();
                    gModel.GarageId       = item.GarageId;
                    gModel.Garage_Name    = item.Garage_Name;
                    gModel.Garage_Address = item.Garage_Address;
                    gModel.OpenTime       = item.OpenTime;
                    gModel.Latitute       = item.Latitute;
                    gModel.Longitude      = item.Longitude;

                    if (item.OpenTime.HasValue)
                    {
                        DateTime opentime = DateTime.Today.Add(item.OpenTime.Value);
                        gModel.OpenTimeStr = opentime.ToString("hh:mm tt");
                    }
                    gModel.CloseTime = item.CloseTime;
                    DateTime closetime = DateTime.Today.Add(item.CloseTime);
                    gModel.CloseTimeStr = closetime.ToString("hh:mm tt");

                    gModel.ServiceDays = item.ServiceDays;
                    if (item.City1 != null)
                    {
                        gModel.City = item.City1.CityName;
                    }
                    if (item.State1 != null)
                    {
                        gModel.State = item.State1.StateName;
                    }
                    gModel.Pincode = item.Pincode;
                    model.Garages.Add(gModel);
                }
                model.Result = true;
            }
            catch (Exception ex)
            {
            }

            return(model);
        }