Inheritance: KnowYourTurf.Core.ViewModel
示例#1
0
        public ActionResult Save(WeatherViewModel input)
        {
            var weather = input.Weather.EntityId > 0 ? _repository.Find<Weather>(input.Weather.EntityId) : new Weather();
            var newTask = mapToDomain(input, weather);

            var crudManager = _saveEntityService.ProcessSave(newTask);
            var notification = crudManager.Finish();
            return Json(notification, JsonRequestBehavior.AllowGet);
        }
示例#2
0
 public ActionResult AddEdit(ViewModel input)
 {
     var weather = input.EntityId > 0 ? _repository.Find<Weather>(input.EntityId) : new Weather();
     var model = new WeatherViewModel
     {
         Weather = weather,
     };
     return PartialView("WeatherAddUpdate", model);
 }
示例#3
0
 public ActionResult Display(ViewModel input)
 {
     var weather = _repository.Find<Weather>(input.EntityId);
     var model = new WeatherViewModel
                     {
                         Weather = weather,
                         AddEditUrl = UrlContext.GetUrlForAction<WeatherController>(x => x.AddEdit(null)) + "/" + weather.EntityId
                     };
     return PartialView("WeatherView", model);
 }
示例#4
0
 private Weather mapToDomain(WeatherViewModel input, Weather weather)
 {
     var weatherModel = input.Weather;
     weather.DewPoint = weatherModel.DewPoint;
     weather.EvaporationRate = weatherModel.EvaporationRate;
     weather.HighTemperature = weatherModel.HighTemperature;
     weather.Humidity = weatherModel.Humidity;
     weather.LowTemperature = weatherModel.LowTemperature;
     weather.RainPrecipitation = weatherModel.RainPrecipitation;
     weather.WindSpeed = weatherModel.WindSpeed;
     return weather;
 }