public List <IssuedBookModel> GetIssuedBKs() { List <IssuedBookModel> lstbookmodels = new List <IssuedBookModel>(); using (connection = new SqlConnection(ConnectionString)) { using (command = new SqlCommand(HelperConstants.sp_GetIssuedBooks, connection)) { command.CommandTimeout = 0; command.CommandType = CommandType.StoredProcedure; connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { IssuedBookModel model = new IssuedBookModel(); model.EmployeeName = Convert.ToString(reader[HelperConstants.EmployeeName]); model.EmployeeId = Convert.ToInt32(reader[HelperConstants.EmployeeId]); model.Vertical = Convert.ToString(reader[HelperConstants.Vertical]); model.ContactNo = Convert.ToString(reader[HelperConstants.ContactNo]); model.EmailID = Convert.ToString(reader[HelperConstants.EmailID]); model.Name = Convert.ToString(reader[HelperConstants.Name]); model.ISBN = Convert.ToString(reader[HelperConstants.tb_lstBK_ISBN]); model.DateofIssue = Convert.ToDateTime(reader[HelperConstants.DateofIssue]); model.DateofReturn = Convert.ToString(reader[HelperConstants.DateofReturn]); lstbookmodels.Add(model); } } } } return(lstbookmodels); }
public PartialViewResult GetIssuedBooks() { Books book = new Books(); IssuedBookModel model = new IssuedBookModel(); book.lstIssuedBook = _dl.GetIssuedBKs(); return(PartialView(HelperConstants.pv_GetAllIssuedBooks, book)); }