public ActionResult SortLocationsByCity(String name, LocationType type) { if (type.Equals(LocationType.CINEMA)) { ViewBag.Message = "Cinemas "; List <Location> retVal = new List <Location>(); ApplicationDbContext dbCtx = ApplicationDbContext.Create(); retVal = dbCtx.Locations.ToList(); List <Location> cinemas = new List <Location>(); foreach (Location loc in retVal) { if (loc.LocType == LocationType.CINEMA) { cinemas.Add(loc); } } List <Location> SortedList = cinemas.OrderBy(o => o.City).ToList(); ViewBag.type = LocationType.CINEMA; ViewBag.locations = SortedList; CinemaViewModel cvm = new CinemaViewModel { Type = LocationType.CINEMA }; return(View("ShowCinemas", cvm)); } else { ViewBag.Message = "Theatres :"; List <Location> retVal = new List <Location>(); ApplicationDbContext dbCtx = ApplicationDbContext.Create(); retVal = dbCtx.Locations.ToList(); List <Location> theatres = new List <Location>(); foreach (Location loc in retVal) { if (loc.LocType == LocationType.THEATRE) { theatres.Add(loc); } } List <Location> SortedList = theatres.OrderBy(o => o.City).ToList(); ViewBag.type = LocationType.THEATRE; ViewBag.locations = SortedList; CinemaViewModel cvm = new CinemaViewModel { Type = LocationType.THEATRE }; return(View("ShowCinemas", cvm)); } }
/// <summary> /// The constructor of the GpsSatellite class. /// </summary> /// <since_tizen> 3 </since_tizen> /// <param name="locator">The locator object initilized using GPS.</param> /// <exception cref="ArgumentException">Thrown when an invalid argument is used.</exception> public GpsSatellite(Locator locator) { Log.Info(Globals.LogTag, "Calling GpsSatellite constructor"); if (locator == null) { Log.Error(Globals.LogTag, "locator is null"); throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); } LocationType method = locator.LocationType; if (method.Equals(LocationType.Gps) || method.Equals(LocationType.Hybrid)) { _locator = locator; _handle = _locator.GetHandle(); } else { Log.Error(Globals.LogTag, "Error constructing GpsSatellite class"); throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); } }