// GET: Clsses public IActionResult Index() { AcaFunctions.GetSchTeachers(_context, false); ViewBag.dropdownTeacher = drpTeachLst; //ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); //new string[] { "Badminton", "Basketball", "Cricket", "Football", "Golf", "Gymnastics", "Hockey", "Tennis" }; AcaFunctions.GetSchSession(_context); ViewBag.dropdownSession = strSessLst; return(View()); }
public IActionResult Create([Bind("ClsName,ClassTeacher,ClssNum")] Clss clss) { if (ModelState.IsValid) { if (!ClssExists(clss.ClsName)) { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(GloVar.iBaseURI); MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json"); client.DefaultRequestHeaders.Accept.Add(contentType); string stringData = JsonConvert.SerializeObject(clss); var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync("/api/Clsses", contentData).Result; ViewBag.Message = response.Content.ReadAsStringAsync().Result; if (response.IsSuccessStatusCode) { ViewBag.Remark = "Creation of Class '" + clss.ClsName + "' Successful"; AcaFunctions.GetSchTeachers(_context, true); ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); return(View()); } else { ViewBag.Remark = "Creation of Class '" + clss.ClsName + "' Failed!. Please Try Again"; AcaFunctions.GetSchTeachers(_context, true); ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); return(View(clss)); } } } else { ViewBag.Remark = "Failed Class '" + clss.ClsName + "' Already Exists."; AcaFunctions.GetSchTeachers(_context, true); ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); return(View(clss)); } } else { ViewBag.Remark = "Failed! Class '" + clss.ClsName + "' Unable To create. PleaseTry Again."; AcaFunctions.GetSchTeachers(_context, true); ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); return(View(clss)); } }
// GET: Subjects public async Task <IActionResult> Index() { GetSchClss(_context); //ViewBag.clsses = GetSchClss(_context, GloVar.dSess); //List<string> ls = new List<string>(); ViewBag.clsses = StrClsLst; //ls.Add("All"); //ls.Add("IX-A"); //ls.Add("IX-B"); //List<dropDown> lsTeach = new List<dropDown>(); //lsTeach.Add(new dropDown("All", "All")); //lsTeach.Add(new dropDown("Ferasat", "Ferasat")); //lsTeach.Add(new dropDown("Gaurav", "Gaurav")); //lsTeach.Add("All"); //lsTeach.Add("Ferasat"); //lsTeach.Add("Gaurav"); //ViewBag.clsses = ls; AcaFunctions.GetSchTeachers(_context, false); ViewBag.dropdownTeacher = drpTeachLst; return(View()); }
// GET: Clsses/Create public IActionResult Create() { AcaFunctions.GetSchTeachers(_context, true); ViewBag.dropdownTeacher = new SelectList(SchTeachLst, "Value", "Text", null); return(View()); }