Example #1
0
        public ActionResult Add()
        {
            ViewBag.Title       = Resources.PageTitle.Level2_Add;
            ViewBag.PageBar     = GetPageBar(Resources.PageTitle.Level2_Add);
            ViewBag.Description = "";
            var model = new Level2ViewModel();

            model.Published = true;
            return(View(model));
        }
Example #2
0
        public JsonResult Add(Level2ViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.IsDefault)
                {
                    _Level2Service.UpdateDefaultFalse();
                }
                var EntityMapped = Mapper.Map <Level2>(model);
                _Level2Service.Add(EntityMapped);
                return(Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet));
            }
            var errors = ModelState.GetDistinctModelErrors();

            return(Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public JsonResult Edit(Level2ViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.IsDefault)
                {
                    _Level2Service.UpdateDefaultFalse();
                }
                var Level2Entity = _Level2Service.GetById(model.Id);
                Level2Entity = Mapper.Map(model, Level2Entity);
                _Level2Service.Edit(Level2Entity);
                return(Json(new { data = model, success = true }, JsonRequestBehavior.AllowGet));
            }
            var errors = ModelState.GetDistinctModelErrors();

            return(Json(new { data = model, success = false, ErrorsList = errors }, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            _context        = (Level2ViewModel)DataContext;
            _context.Dialog = DialogCoordinator.Instance;
            var vis = _context.IsUSA ? Visibility.Visible : Visibility.Collapsed;

            _context.IsUsaChanged += OnIsUsaChanged;
            if (_alertSize != 0)
            {
                _context.AlertSize = _alertSize;
            }
            if (_alertTwoSize != 0)
            {
                _context.AlertTwoSize = _alertTwoSize;
            }
            ColumnSource1.Visibility = vis;
            ColumnSource2.Visibility = vis;
        }