internal HttpResponseMessage Farms(HttpRequestMessage request, FarmDTO cqDTO) { string key; var aur = new AppUserRepository(); var companyId = 0; var UserId = aur.ValidateUser(cqDTO.Key, out key, ref companyId); AppUserRoleRepository aur1 = new AppUserRoleRepository(); if (UserId > 0 && aur1.IsInRole(UserId, "User")) { var ur = new FarmRepository(); var u = new Farm(); cqDTO.CompanyId = companyId.ToString(); var predicate = ur.GetPredicate(cqDTO, u, companyId); var data = ur.GetByPredicate(predicate); var col = new Collection<Dictionary<string, string>>(); foreach (var item in data) { var dic = new Dictionary<string, string>(); dic.Add("FarmId", item.FarmId.ToString()); dic.Add("FarmName", item.FarmName); dic.Add("StatusId", item.StatusId.ToString()); col.Add(dic); } var retVal = new GenericDTO { Key = key, ReturnData = col }; return Request.CreateResponse(HttpStatusCode.OK, retVal); } var message = "validation failed"; return request.CreateResponse(HttpStatusCode.NotFound, message); }