public ActionResult Search(int zip)
        {
            var result = new SearchModel();

            using (var data = new WeatherDBContext()) {
                var query = from wf in data.Weathers
                            where wf.ZIPCODE == zip
                            select wf;

                int count = 0;

                foreach (var q in query)
                {
                    count++;
                    result.id          = q.ID;
                    result.zipcode     = q.ZIPCODE;
                    result.location    = q.LOCATION;
                    result.forecast    = q.FORECAST;
                    result.temperature = q.TEMPERATURE;
                }

                if (count == 0)
                {
                    return(new EmptyResult());
                }
            }


            return(View(result));
        }
Ejemplo n.º 2
0
 public void PostRequestHandlerExecute(object sender, EventArgs e)
 {
     try {
         WeatherDBContext.TryDisposeCurrentHttpContext();
     } finally {
     }
 }
Ejemplo n.º 3
0
 public WeatherMeasureRepository(WeatherDBContext dbContext)
 {
     _dbContext = dbContext;
 }
Ejemplo n.º 4
0
 public WeatherService()
 {
     db = new WeatherDBContext();
     exelParseService = new ExelParseService();
 }
Ejemplo n.º 5
0
 public CityRepository(WeatherDBContext dbContext)
 {
     _dbContext = dbContext;
 }
Ejemplo n.º 6
0
 public UserRepository(WeatherDBContext dbContext)
 {
     _dbContext = dbContext;
 }
 public WeatherDataAccessLayer(WeatherDBContext context, IMapper mapper)
 {
     DBCtx       = context;
     this.mapper = mapper;
 }
 public static IWeatherDataAccessLayer GetInstance()
 {
     return(new WeatherDataAccessLayer(WeatherDBContext.GetInstance(), AutomapperConfiguration.Configure().CreateMapper()));
 }