Example #1
0
 public async Task <IActionResult> Add(Cinema model)
 {
     if (ModelState.IsValid)
     {
         await _cinemaService.AddAsync(model);
     }
     return(RedirectToAction("Index"));
 }
Example #2
0
 public async Task <IActionResult> Add(Cinema model)
 {
     if (ModelState.IsValid)
     {
         await _cinemaService.AddAsync(model);
     }
     // 跳转回本 controller 下面的 action,即 Index action
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> Add(Cinema model)
        {
            if (ModelState.IsValid)//检查model的有效性
            {
                await _cinemaService.AddAsync(model);
            }

            return(RedirectToAction("Index"));//添加完成后跳转到电影院列表页面
        }
Example #4
0
 [HttpPost]//添加,不然默认是[HttpGet](查询),上面得到就是
 public async Task <IActionResult> add(Cinema model)
 {
     //model的验证
     if (ModelState.IsValid)
     {
         await _cinemaService.AddAsync(model);
     }
     //跳转回HomeController下面的Action
     return(RedirectToAction("Index"));
 }
Example #5
0
 //添加电影院信息
 public IActionResult add()
 {
     ViewBag.Title = "添加电影院";
     return(View(_cinemaService.AddAsync(new Cinema())));
 }