Exemplo n.º 1
0
 // GET: ActivityGroups
 public async Task <IActionResult> Index()
 {
     AcaFunctions.GetActivityGradeType(_context, false);
     AcaFunctions.GetSchSession(_context);
     AcaFunctions.GetSchClss(_context);
     ViewBag.dropdownSession   = strSessLst;
     ViewBag.dropdownGradeType = drpActGrdLst;
     ViewBag.dropdownClss      = drpClsLst;
     return(View());
 }
Exemplo n.º 2
0
        //private AcaFunctions acaFunctions = new AcaFunctions ();
        //private StdFns stdFns= new StdFns ();

        public ActionResult Index(SearchStd model)
        {
            string searchStr = model.SeaStr;
            IEnumerable <Students> StdDets;

            if (model.SClass == null)
            {
                SearchStd searchStd = new SearchStd
                {
                    SStdID     = 0,
                    SUniReg    = 0,
                    SRegNumber = 0,
                    SStdName   = "",
                    SeaStr     = "",
                    SClass     = "",
                    SGender    = 0,
                    SDOB       = DateTime.Now
                };
                //searchStd.stdList = stdFns.GetStdList(_context, "2016-17", "").Result;
                GetSchClss(_context);
                ViewBag.clsses = StrClsLst;
                //ViewBag.stdList = new SelectList(SchClsLst, "Value", "Text", null);
                return(View(searchStd));
            }
            else
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        ViewBag.sClss = model.SClass;
                        AcaFunctions.GetSchClss(_context);
                        ViewBag.stdList = new SelectList(SchClsLst, "Value", "Text", null);

                        using (HttpClient client = new HttpClient())
                        {
                            client.BaseAddress = new Uri(GloVar.iBaseURI);
                            MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json");
                            client.DefaultRequestHeaders.Accept.Add(contentType);
                            HttpResponseMessage response = client.GetAsync("/api/SearchStds?SClass=" + model.SClass + "&tSearchStr=" + searchStr + "&dSess=" + dSess + "&mdBID=" + mdBId).Result;  //
                            var stringData = response.Content.ReadAsStringAsync().Result;
                            StdDets = JsonConvert.DeserializeObject <IEnumerable <Students> >(stringData);
                        }

                        ViewBag.datasource = StdDets;
                    }
                    return(View(model));
                }
                catch
                {
                    return(View());
                }
            }
        }