Пример #1
0
        public IActionResult CreateTimeVM()
        {
            var vm   = new TimeVM();
            var time = vm.TimeFrom.ToString("hh\\:mm");

            return(View(vm));
        }
Пример #2
0
 public async Task <IActionResult> CreateTimeVM(TimeVM input)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     return(View());
 }
Пример #3
0
 public ActionResult Editar(int id)
 {
     TimeVM data = Mapper.Map<TimeVM>(_timeService.GetById(id));
     data.ListaEstadios = _estadioService.BuscarAtivos().Select(x => new SelectListItem()
     {
         Value = x.Id.ToString(),
         Text = string.IsNullOrEmpty(x.Apelido) || string.IsNullOrWhiteSpace(x.Apelido) ? x.Nome : x.Apelido
     });
     data.LstStatus = Utils.ListarStatus();
     return View(data);
 }
Пример #4
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public WidgetTime()
        {
            _fullWidget = new TimeWidgetFull();
            _rightLeftWidget = new TimeWidgetReduce();
            _topBotWidget = new TimeWidgetReduce();

            _dataContext = (TimeVM)_fullWidget.DataContext;

            _topBotWidget.DataContext = _dataContext;
            _rightLeftWidget.DataContext = _dataContext;
        }
Пример #5
0
 public ActionResult Criar()
 {
     TimeVM data = new TimeVM() {
         ListaEstadios = _estadioService.BuscarAtivos().Select(x => new SelectListItem()
         {
             Value = x.Id.ToString(),
             Text = string.IsNullOrEmpty(x.Apelido) || string.IsNullOrWhiteSpace(x.Apelido) ? x.Nome : x.Apelido
         }),
         LstStatus = Utils.ListarStatus()
     };
     return View(data);
 }
Пример #6
0
        void refreshPattern()
        {
            // 刷新界面编辑(TODO)
            ClassVM.Refresh();

            CourseVM.Refresh();

            StudentVM.Refresh();

            TagVM.Refresh();

            TeacherVM.Refresh();

            TimeVM.Refresh();

            RuleVM.Refresh();
        }
Пример #7
0
        private ActionResult Salvar(TimeVM timeVM)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    throw new Exception("O modelo não é válido.");
                }

                var time = Mapper.Map <TimeVM, Time>(timeVM);

                logic.Save(time);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(timeVM));
            }
        }
Пример #8
0
        public ActionResult GetVestigingOpeningHourByLocationId(int Id, string date)
        {
            object[] item = _locationService.GetVestigingOpeningHourByLocationId(Id, DateTime.ParseExact(date, GlobalStatic.DateFormatString, CultureInfo.InvariantCulture));

            if (item != null)
            {
                var minTime = new TimeVM();
                var maxTime = new TimeVM();

                int tempTryResult = 0;

                if (item[0] != null)
                {
                    minTime.Hour   = int.TryParse(item[0].ToString().Split('.')[0], out tempTryResult) ? tempTryResult : 0;
                    minTime.Minute = int.TryParse(item[0].ToString().Split('.')[1], out tempTryResult) ? tempTryResult : 0;
                }
                else
                {
                    minTime = null;
                }

                if (item[1] != null)
                {
                    maxTime.Hour   = int.TryParse(item[1].ToString().Split('.')[0], out tempTryResult) ? tempTryResult : 0;
                    maxTime.Minute = int.TryParse(item[1].ToString().Split('.')[1], out tempTryResult) ? tempTryResult : 0;
                }
                else
                {
                    maxTime = null;
                }

                return(Json(new { minTime, maxTime, availableDates = item[2] }, JsonRequestBehavior.AllowGet));
            }

            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
 public ActionResult Editar(TimeVM timeVM)
 {
     return(Salvar(timeVM));
 }
Пример #10
0
 public ActionResult Editar(TimeVM model)
 {
     _timeService.Update(Mapper.Map<Time>(model));
     return RedirectToAction("Index");
 }
Пример #11
0
 public ActionResult Criar(TimeVM model)
 {
     _timeService.Add(Mapper.Map<Time>(model));
     return RedirectToAction("Index");
 }