public string EditFinal(Mark mark) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update mark_final set mark='{mark.S_mark}' where studentrollno_id={mark.Id} and subject_id={mark.Subject_id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); // conn.Close(); } int tmk = context.GetFinal_Mark(mark.Id, academic_id); int total_mk = context.GetTotalMark(mark.Id, academic_id); int pass = context.GetEditPass(mark.Id, academic_id); string sql1 = $"Update result set final_mark='{tmk}',total_mark={total_mk},pass={pass} where studentrollno_id={mark.Id} and academic_id={academic_id}"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return("OK"); }
public string EditAssignment(Assignment assignment) { SystemContext context = HttpContext.RequestServices.GetService(typeof(Exam_Management_System.Models.SystemContext)) as SystemContext; int academic_id = context.GetAcademic().Id; using (MySqlConnection conn = context.GetConnection()) { conn.Open(); string sql = $"Update assignment set mark='{assignment.Mark}' where id={assignment.Id}"; using (MySqlCommand command = new MySqlCommand(sql, conn)) { command.ExecuteNonQuery(); // conn.Close(); } int total_mark = context.GetTotalMark(assignment.Rollno_id, context.GetAcademic().Id); int pass = context.GetEditPass(assignment.Rollno_id, academic_id); string sql1 = $"Update result set total_mark='{total_mark}',pass={pass} where studentrollno_id={assignment.Rollno_id}"; using (MySqlCommand command = new MySqlCommand(sql1, conn)) { command.ExecuteNonQuery(); conn.Close(); } } return("This assignment is edit!"); }