public ActionResult Index()
        {
            ViewBag.Feature = "Danh sách";
            ViewBag.Element = KeyElement;

            if (Request.Url != null)
            {
                ViewBag.BaseURL = Request.Url.LocalPath;
            }

            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                var lstRole = RoleKey.GetDic();
                ViewBag.Roles = new SelectList(lstRole, "Value", "Text");

                List <Patient> patients = new List <Patient>();
                patients = new PatientManagementDbContext().Database.SqlQuery <Patient>("exec getPatient").ToList();


                ViewBag.Patients = new SelectList(patients, "Id", "FullName");

                List <BELibrary.Entity.Doctor> doctors = new List <BELibrary.Entity.Doctor>();
                doctors = new PatientManagementDbContext().Database.SqlQuery <BELibrary.Entity.Doctor>("exec getDoctor").ToList();

                ViewBag.Doctors = new SelectList(doctors, "Id", "Name");

                var listData = workScope.Accounts.GetAll().ToList();
                return(View(listData));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(int role)
        {
            ViewBag.key     = "Thêm mới";
            ViewBag.Element = RoleKey.GetRoleText(role);

            ViewBag.isEdit  = false;
            ViewBag.Role    = role;
            ViewBag.Genders = new SelectList(GenderKey.GetDic(), "Key", "Value");
            ViewBag.Roles   = new SelectList(RoleKey.GetDic(), "Key", "Value");

            return(View());
        }
Exemplo n.º 3
0
        public ActionResult Update(string username, int role)
        {
            ViewBag.isEdit = true;
            ViewBag.Role   = role;
            ViewBag.key    = "Cập nhật";

            ViewBag.Element = RoleKey.GetRoleText(role);
            ViewBag.Genders = new SelectList(GenderKey.GetDic(), "Key", "Value");
            ViewBag.Roles   = new SelectList(RoleKey.GetDic(), "Key", "Value");

            using (var workScope = new UnitOfWork(new ELearningDBContext()))
            {
                var acc = workScope.Account.FirstOrDefault(x => x.Username == username);
                acc.Password = "";
                return(View("Create", acc));
            }
        }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            ViewBag.Feature = "Danh sách";
            ViewBag.Element = KeyElement;

            if (Request.Url != null)
            {
                ViewBag.BaseURL = Request.Url.LocalPath;
            }

            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                var lstRole = RoleKey.GetDic();
                ViewBag.Roles = new SelectList(lstRole, "Value", "Text");

                var patients = workScope.Patients.GetAll().ToList();
                ViewBag.Patients = new SelectList(patients, "Id", "FullName");

                var listData = workScope.Accounts.GetAll().ToList();
                return(View(listData));
            }
        }