public string Save(StudentResult studentResult) { StudentResult result = GetAllResult.ToList() .Find(st => st.StudentId == studentResult.StudentId && st.CourseId == studentResult.CourseId); if (result == null) { if (studentGateway.Insert(studentResult) > 0) { return("Saved sucessfull!"); } return("Failed to save"); } if (result.Status) { return("This course result already saved"); } if (studentGateway.UpdateStudentResult(studentResult) > 0) { return("Saved sucessfull!"); } return("This course result already saved"); }
private bool IsResulExits(StudentResult studentResult) { StudentResult result = GetAllResult.ToList() .Find(st => st.StudentId == studentResult.StudentId && st.CourseId == studentResult.CourseId); if (result != null) { return(true); } return(false); }