Exemplo n.º 1
0
 public IActionResult Them(TheLoaiIndexVm theLoaiVM)
 {
     if (ModelState.IsValid)
     {
         theLoaiService.ThemTheLoai(theLoaiVM.theLoai);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemplo n.º 2
0
        public IActionResult Sua(TheLoaiIndexVm theLoaiVm)
        {
            if (ModelState.IsValid)
            {
                theLoaiService.SuaTheLoai(theLoaiVm.theLoai);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Exemplo n.º 3
0
        public IActionResult Index(string sortOrder, string searchString, int pageIndex = 1)
        {
            int pageSize = 8;
            int count;
            var theLoais   = theLoaiService.GetTheLoais(sortOrder, searchString, pageIndex, pageSize, out count);
            var theLoaiNew = new TheLoaiDTO();

            var theLoaiVM = new TheLoaiIndexVm()
            {
                TheLoais     = new PaginatedList <TheLoaiDTO>(theLoais, count, pageIndex, pageSize),
                SearchString = searchString,
                SortOrder    = sortOrder,
                theLoai      = theLoaiNew
            };

            return(View(theLoaiVM));
        }
Exemplo n.º 4
0
 public IActionResult Xoa(TheLoaiIndexVm theLoaiVm)
 {
     theLoaiService.XoaTheLoai(theLoaiVm.theLoai.MaTL);
     return(RedirectToAction("Index"));
 }