public bool Save(StudentModel category) { try { var query = "INSERT INTO tblStudent (DepartmentId, CourseId, StudentName,Roll,Email) VALUES('" + category.DepartmentId + "','" + category.CourseId + "','" + category.StudentName + "','" + category.Roll + "','" + category.Email + "')"; var rowAffected = _sDB.ExecuteNonQuery(query, _connectionString); return(rowAffected > 0); } catch (Exception e) { throw new Exception(e.Message); } }
public bool Save(DepartmentModel category) { try { var query = "INSERT INTO tblDepartment (Code, Department) VALUES('" + category.Code + "','" + category.Department + "')"; var rowAffected = _sDB.ExecuteNonQuery(query, _connectionString); return(rowAffected > 0); } catch (Exception e) { throw new Exception(e.Message); } }