public Studied GetStudentResultForCourse(String courseCode, String ssn) { try { Studied s = context.usp_GetStudentResultForCourse(courseCode, ssn).SingleOrDefault <Studied>(); return(s); } catch (SqlException) { throw; } }
private void button_givenStudentGivenCourse_Click(object sender, EventArgs e) { Studied studied = new Studied(); studied.ssn = comboBox_chooseStudentGivenCourse.Text; studied.courseCode = comboBox_courseForGivenStudent.Text; try { } catch { } }
private void button_giveGradeToStudent_Click(object sender, EventArgs e) { Studied studied = new Studied(); studied.ssn = comboBox_studentFinished.Text; studied.courseCode = comboBox_courseFinished.Text; studied.grade = Convert.ToInt32(comboBox_chooseGrade.Text); try { } catch { } }
public IHttpActionResult AddEducation(Studied education) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Studieds.Add(education); try { db.SaveChanges(); } catch (DbUpdateException) { return(Ok("error")); } return(Ok("success")); }
public async Task <ActionResult> Education(FormCollection collection) { if (Session["user_type"].Equals("GST") || Session["user_type"].Equals("CMP")) { return(RedirectToAction("/Home/Index")); } Studied s = new Studied(); if (string.IsNullOrWhiteSpace(Request.Form["cname-education"]) && !string.IsNullOrWhiteSpace(Request.Form["college"])) { s.Name = Request.Form["college"]; } else if (!string.IsNullOrWhiteSpace(Request.Form["cid-education"])) { s.GoogleId = Request.Form["cid-education"]; s.Name = Request.Form["cname-education"]; } else { return(RedirectToAction("../Student/Details/" + Session["user_id"])); } if (string.IsNullOrWhiteSpace(Request.Form["graduation"])) { s.GraduationYear = null; } else { s.GraduationYear = Convert.ToDecimal(Request.Form["graduation"]); } s.Degree = Convert.ToInt32(Request.Form["degree"]); s.S_Id = Session["user_id"].ToString(); try { string response = ""; using (var client = new HttpClient()) { client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Clear(); //Define request data format client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //Sending request to find web api REST service resource GetAllEmployees using HttpClient HttpResponseMessage Res = await client.PostAsJsonAsync("api/extraAPI/Education", s); //Checking the response is successful or not which is sent using HttpClient if (Res.IsSuccessStatusCode) { //Storing the response details recieved from web api var StudentResponse = Res.Content.ReadAsStringAsync().Result; //Deserializing the response recieved from web api and storing into the Employee list response = JsonConvert.DeserializeObject <string>(StudentResponse); } } return(RedirectToAction("../Student/Details/" + Session["user_id"])); } catch { return(RedirectToAction("../Student/Details/" + Session["user_id"])); } }