コード例 #1
0
        public ActionResult AddModel()
        {
            AddEditModel Setupadd = new AddEditModel();

            Setupadd.SetMakeChoices();
            return(View(Setupadd));
        }
コード例 #2
0
ファイル: AddEditView.xaml.cs プロジェクト: ehelin/TGIMBA
        public AddEditView()
        {
            InitializeComponent();

            addEditModel = new AddEditModel();

            cbCategory.Items.Add("Hot");
            cbCategory.Items.Add("Warm");
            cbCategory.Items.Add("Cold");
        }
コード例 #3
0
        public IActionResult AddEdit(AddEditModel model)
        {
            var entity = model.MapTo <Department>();

            var result = model.Id.IsNullOrWhiteSpace()
                ? _departmentService.Add(entity)
                : _departmentService.Update(entity);

            return(Json(result));
        }
コード例 #4
0
        public ActionResult AddModel2(AddEditModel ToAdd)
        {
            CarRepoADO   repo    = new CarRepoADO();
            AddEditModel forview = new AddEditModel();

            if (ModelState.IsValid)
            {
                CarModels AddME = new CarModels();
                AddME.ModelName = ToAdd.ModelName;
                AddME.MakeID    = ToAdd.MakeID;
                repo.AddModel(AddME);
                forview.SetMakeChoices();
                return(View("AddModel", forview));
            }
            else
            {
                ToAdd.SetMakeChoices();
                return(View("AddModel", ToAdd));
            }
        }
コード例 #5
0
        public ActionResult AddModel(AddEditModel ToAdd)
        {
            CarRepoADO   repo    = new CarRepoADO();
            AddEditModel forview = new AddEditModel();

            forview.SetMakeChoices();
            if (!string.IsNullOrWhiteSpace(ToAdd.ModelToAdd.ModelName))
            {
                CarModels AddME = new CarModels();
                AddME.ModelName = ToAdd.ModelToAdd.ModelName;
                AddME.MakeID    = ToAdd.ModelToAdd.MakeID;
                repo.AddModel(AddME);
                return(View("AddModel", forview));
            }
            else
            {
                ToAdd.SetMakeChoices();
                return(View("AddModel", ToAdd));
            }
        }
コード例 #6
0
        public IActionResult AddEdit(AddEditModel model)
        {
            var isNameExists = _menuService.IsNameExists(model.Id, model.Name);

            if (isNameExists.Failed)
            {
                return(Json(isNameExists));
            }

            var entity = model.MapTo <Menu>();

            if (model.Id.IsNullOrWhiteSpace())
            {
                _menuService.Add(entity);
            }
            else
            {
                _menuService.Update(entity);
            }

            return(Json(ServiceResult.IsSuccess("操作成功")));
        }