public void GetAllTest() { var target = new RoleDao(); ReadOnlyCollection <Role> actual; actual = target.GetAll(); Assert.AreEqual(2, actual.Count); }
public JsonResult GetRoles(string sord, int page, int rows, string searchString) { //#1 Create Instance of DatabaseContext class for Accessing Database. //#2 Setting Paging int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; var db = new RoleDao(); //#3 Linq Query to Get Customer var Results = db.GetAll(); //#4 Get Total Row Count int totalRecords = Results.Count(); var totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows); //#5 Setting Sorting if (sord.ToUpper() == "DESC") { Results = Results.OrderByDescending(s => s.ID); Results = Results.Skip(pageIndex * pageSize).Take(pageSize); } else { Results = Results.OrderBy(s => s.ID); Results = Results.Skip(pageIndex * pageSize).Take(pageSize); } //#6 Setting Search if (!string.IsNullOrEmpty(searchString)) { Results = Results.Where(m => m.Name.Contains(searchString)).ToList(); } //#7 Sending Json Object to View. var jsonData = new { total = totalPages, page, records = totalRecords, rows = Results }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public void GetAllTest() { var target = new RoleDao(); ReadOnlyCollection<Role> actual; actual = target.GetAll(); Assert.AreEqual(2, actual.Count); }
public List <RoleObject> GetAll() { return(ModelRole.GetAll()); }
public void GetAll() { var models = RoleDao.GetAll(); Assert.IsNotNull(models); }
public List <RoleDTO> getAllR() { return(Rdao.GetAll()); }
public UserController() { _roleDao = new RoleDao(); _userDao = new UserDao(); _roles = _roleDao.GetAll().ToList(); }