コード例 #1
0
        public IActionResult Details(string id, int id2)
        {
            ModelRepo modRepo = new ModelRepo(db);
            var       model   = modRepo.Get(id, id2);

            return(View(model));
        }
コード例 #2
0
        // GET: Model/Edit/5
        public async Task <IActionResult> Edit(string id, int id2)
        {
            ViewData["ManufacturerMake"] = new SelectList(db.Manufacturer, "Make", "Make");
            ModelRepo modRepo = new ModelRepo(db);
            Model     model   = modRepo.Get(id, id2);

            return(View(model));
        }
コード例 #3
0
        public JsonResult LoadModel(int CatId = -1, int BrandId = -1)
        {
            //Your Code For Getting Physicans Goes Here
            var ModelList = new ModelRepo().ModelList(CatId, BrandId);


            var phyData = ModelList.Select(m => new SelectListItem()
            {
                Text  = m.ModelName,
                Value = m.ID.ToString(),
            });

            return(Json(phyData, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public async Task DummyModelRepoIsCorrect(
            List <MainModel> expected,
            ModelRepo sut)
        {
            await sut.PostData(expected);

            using (var conn = new SqlConnection(TestConnectionString))
            {
                var actual = conn.Query <MainModel>("select ModelChars from DummyModel").ToList();

                Assert.True(
                    expected.Select(x => x.ModelChars).AsSet().SetEquals(actual.Select(x => x.ModelChars)));
            }
        }
コード例 #5
0
        public async Task <IActionResult> DeleteConfirmed(string id, int id2)
        {
            bool success;

            success = new ModelRepo(db).Delete(id, id2);
            if (success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Error", "Index"));
            }
        }
コード例 #6
0
        public IActionResult Edit(Model mod)
        {
            bool success = false;

            if (ModelState.IsValid)
            {
                success = new ModelRepo(db).Update(mod);
            }
            if (success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Error", "Index"));
            }
        }