Esempio n. 1
0
        // GET: Weathers
        public ActionResult GetWeatherData(int?year, int?month, int page = 1)
        {
            int pageSize = int.Parse(WebConfigurationManager.AppSettings["PageSize"]);

            #region Mapper
            var config = new MapperConfiguration(map =>
            {
                map.CreateMap <Weather, MoscowWeather.Models.WeatherModel>();
                map.CreateMap <PageModel, PageVM>();
                map.CreateMap <DataLayer.Model.WeatherModel, WeatherVM>()
                .ForMember("PageViewModel", opt => opt.MapFrom(c => c.PageModel));
            });
            var mapper = new Mapper(config);
            #endregion

            DataLayer.Model.WeatherModel weatherViewModel
                = weatherService.GetWeatherData(year, year == null ? null: month, page, pageSize);

            DateVM dateViewModel = new DateVM
            {
                Year  = year,
                Month = month
            };

            WeatherVM weatherVM = mapper.Map <WeatherVM>(weatherViewModel);
            weatherVM.DateViewModel = dateViewModel;

            return(View("Weather", weatherVM));
        }
        public ActionResult MesecniProfitReturn([Bind(Include = "DatumOd, DatumDo")] DateVM datum)
        {
            var     units     = db.Units.ToList();
            decimal profitSum = 0.00m;

            foreach (var item in units)
            {
                profitSum += item.CalculatedProfit;
            }
            ViewBag.Profit = profitSum;
            return(View(units));
        }
Esempio n. 3
0
        void InitialDate()
        {
            if (SelectedDate == null)
            {
                DateTime dt = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
                SelectedDate = new DateVM()
                {
                    Year  = dt.Year.ToString().PadLeft(4, '0'),
                    Month = dt.Month.ToString().PadLeft(2, '0'),
                    Day   = dt.Day.ToString().PadLeft(2, '0')
                };
            }

            this.DataContext = SelectedDate;
        }
        public void AddPerson(DateVM vm)
        {
            var repo = new PeopleRepository(_connection);

            repo.AddPerson(vm.Date);
        }
Esempio n. 5
0
        public double?ShowDateDialog(double jd, double utcOffset, DateOptions displayMode = DateOptions.DateTime)
        {
            var vm = new DateVM(jd, utcOffset, displayMode);

            return((ShowDialog(vm) ?? false) ? (double?)vm.JulianDay : null);
        }