public void AddMark(int Id, float physics, float chemistry, float mathematics, float computing, float english) { StudentMarks mark = new StudentMarks(); mark.ID = Id; mark.Physics = physics; mark.Chemistry = chemistry; mark.Mathematics = mathematics; mark.Computing = computing; mark.English = english; _Context.StudentMarks.Add(mark); _Context.SaveChanges(); }
public void DeleteMark(int id) { StudentMarks mark = _Context.StudentMarks.SingleOrDefault(s => s.ID == id); if (mark != null) { _Context.StudentMarks.Remove(mark); _Context.SaveChanges(); } else { throw new ApplicationException("Cannot find the marks."); } }
public void EditMark(float physics, float chemistry, float mathematics, float computing, float english, int ID) { StudentMarks mark = _Context.StudentMarks.SingleOrDefault(s => s.ID == ID); if (mark != null) { mark.Physics = physics; mark.Chemistry = chemistry; mark.Mathematics = mathematics; mark.Computing = computing; mark.English = english; _Context.SaveChanges(); } else { throw new ApplicationException("Cannot find the marks."); } }