// GET: University
        public ActionResult Index()
        {
            if (Session["PERSONAL_NO"] != null)
            {
                InstituteModel        model    = new InstituteModel();
                InstituteDS           source   = new InstituteDS();
                DataSet               ds       = new DataSet();
                List <InstituteModel> dataList = new List <InstituteModel>();

                ds = source.GetListOfInstitutes();

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    InstituteModel i = new InstituteModel();

                    i.InstituteCode     = dr["InstituteCode"].ToString();
                    i.InstituteName     = dr["InstituteName"].ToString();
                    i.InstituteType     = dr["InstituteType"].ToString();
                    i.UniversityName    = dr["UniversityName"].ToString();
                    i.InstituteState    = dr["InstituteState"].ToString();
                    i.InstituteDistrict = dr["InstituteDistrict"].ToString();
                    dataList.Add(i);
                }



                model.ListInstitute = dataList;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index", "Login", new { area = "" }));
            }
        }
        public InstituteViewModel(IUserInterop userInterop, IControllerInterop controllerInterop, Dispatcher dispatcher)
            : base(userInterop, controllerInterop, dispatcher)
        {
            originalEntity = new InstituteDTO();

            Model = new InstituteModel(originalEntity as InstituteDTO);
            this.Model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ModelPropertyChanged);
        }
        private InstituteModel PrepareInstituteModel(Institute institute)
        {
            InstituteModel instituteTemp = new InstituteModel();

            instituteTemp.Id           = institute.Id;
            instituteTemp.Name         = institute.Name;
            instituteTemp.DistrictName = districtService.GetDistrict(Convert.ToInt32(institute.DistrictId)).Name;
            instituteTemp.DistrictId   = institute.DistrictId;
            return(instituteTemp);
        }
        public DataSet GetListOfInstitutes()
        {
            InstituteModel model = new InstituteModel();
            DataSet        ds    = new DataSet();
            DataTable      dt    = new DataTable();
            string         str   = "";

            try
            {
                str = " "; //Select command for quering the list of institutes

                //Production
                //dt = dc.getQueryViaDataTable(str);

                //Testing
                dt.Clear();
                dt.Columns.Add("InstituteCode");
                dt.Columns.Add("InstituteName");
                dt.Columns.Add("InstituteType");
                dt.Columns.Add("UniversityName");
                dt.Columns.Add("InstituteState");
                dt.Columns.Add("InstituteDistrict");

                object[] a = { "2629", "ANU PG Campus Ongole", "PG Center / Off-Campus Center", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Gurtur" };
                dt.Rows.Add(a);
                object[] a1 = { "32620", "P.N.C.A Degree College", "Affiliated College", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Gurtur" };
                dt.Rows.Add(a1);
                object[] a2 = { "32621", "Venigalla Jayasri Ram College", "Affiliated College", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Gurtur" };
                dt.Rows.Add(a2);
                object[] a3 = { "32622", "S.N.B.T.M. College of Education", "Affiliated College", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Prakasam" };
                dt.Rows.Add(a3);
                object[] a4 = { "32623", "V.T.J.M. & I.V.T.R. Degree College", "Affiliated College", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Prakasam" };
                dt.Rows.Add(a4);
                object[] a5 = { "32624", "Govt. Degree College, Chebrolu", "PG Center / Off-Campus Center", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Prakasam" };
                dt.Rows.Add(a5);
                object[] a6 = { "32627", "S.S. Arts & Science College", "PG Center / Off-Campus Center", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Prakasam" };
                dt.Rows.Add(a6);
                object[] a7 = { "32628", "G.C.K.V.N. Degree College", "PG Center / Off-Campus Center", "Acharya Nagarjuna University, Guntur", "Andhra Pradesh", "Prakasam" };
                dt.Rows.Add(a7);
                ds.Tables.Add(dt);
            }
            catch (Exception Ex)
            {
            }
            return(ds);
        }
        public async Task <InstituteModel> GetInstitute(Guid instituteGuid)
        {
            var specialties = await _dbContext.Specialties.ToListAsync();

            var institute = await _dbContext.Institutes.FirstOrDefaultAsync(e => e.Id == instituteGuid);

            var instituteModel = new InstituteModel()
            {
                Id          = institute.Id,
                Address     = institute.Address,
                Director    = institute.Director,
                Name        = institute.Name,
                Phone       = institute.Phone,
                Type        = institute.Type,
                Url         = institute.Url,
                Specialties = specialties.Where(specialtyFromDb => institute.SpecialtiesGuids.Contains(specialtyFromDb.Id)).ToList()
            };

            return(instituteModel);
        }
 public IViewComponentResult Invoke(InstituteModel model)
 {
     return(View("_ItemInstitute", model));
 }