예제 #1
0
        public PartialViewResult ListDeparment(int?DeparmentID)
        {
            DeparmentService service = new DeparmentService();

            ViewBag.ListDepartmentID = new SelectList(service.GetAllDepartments(), "DepartmentID", "DepartmentName", DeparmentID);
            return(PartialView("_Department"));
        }
예제 #2
0
        public ActionResult Add(int?id)
        {
            DeparmentService service    = new DeparmentService();
            Department       department = service.FindByKey(id);

            return(View(department));
        }
 public ActionResult Delete(int[] cbxItem)
 {
     if (cbxItem.Count() > 0)
     {
         foreach (int item in cbxItem)
         {
             DeparmentService deparmentService = new DeparmentService();
             deparmentService.Delete(item);
             setAlert("Xóa lớp thành công", "success");
         }
     }
     return(RedirectToAction("Index"));
 }
예제 #4
0
        public ActionResult Index(string DepartmentName)
        {
            DeparmentService service            = new DeparmentService();
            int pageNumber                      = 1;
            IPagedList <Department> departments = service.GetDepartments(DepartmentName
                                                                         , pageNumber
                                                                         , 10
                                                                         );

            ViewBag.DepartmentName = DepartmentName;
            ViewBag.PageCurrent    = pageNumber;
            return(View(departments));
        }
예제 #5
0
        public ActionResult Index(string DepartmentName, int?CurrentPage)
        {
            DeparmentService deparmentService = new DeparmentService();
            int pageNumber = CurrentPage ?? 1;
            IPagedList <Department> departments = deparmentService.GetDepartments(DepartmentName
                                                                                  , pageNumber
                                                                                  , 10
                                                                                  );

            ViewBag.StudentCode = DepartmentName;
            ViewBag.PageCurrent = CurrentPage;
            return(View(departments));
        }
예제 #6
0
        public ActionResult Add(int?Id
                                , string DepartmentName
                                , string Description
                                , bool Status
                                )
        {
            DeparmentService deparmentService = new DeparmentService();
            Department       department       = deparmentService.FindByKey(Id);

            department.DepartmentName = DepartmentName;
            department.Description    = Description;
            department.Status         = Status;
            if (Id.HasValue)
            {
                deparmentService.Update(department);
                setAlert("Sửa khoa thành công", "success");
            }
            else
            {
                deparmentService.Insert(department);
                setAlert("Thêm khoa thành công", "success");
            }
            return(RedirectToAction("Index"));
        }
예제 #7
0
 public SellersController(SellerService sellerService, DeparmentService deparmentService)
 {
     _sellerService    = sellerService; // Construtor da injeção de dependência
     _deparmentService = deparmentService;
 }