public HttpResponseMessage Search([FromUri] AspNetUserRoleSearchRequest model)
        {
            ItemsResponse <AspNetUserRole> response = new ItemsResponse <AspNetUserRole>();

            response.Items = _AspNetUserRoleService.Search(model);

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Beispiel #2
0
        public List <AspNetUserRole> Search(AspNetUserRoleSearchRequest model)
        {
            List <AspNetUserRole> list = null;

            DataProvider.ExecuteCmd(GetConnection, "dbo.AspNetUserRoles_Search",
                                    inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Name", model.Name);
                paramCollection.AddWithValue("@Role", model.Role);
                paramCollection.AddWithValue("@CurrentPage", model.CurrentPage);
                paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage);
            }
                                    , map : delegate(IDataReader reader, short set)
            {
                switch (set)
                {
                case 0:

                    AspNetUserRole a = new AspNetUserRole();
                    int ord          = 0; //startingOrdinal

                    a.FirstName    = reader.GetSafeString(ord++);
                    a.LastName     = reader.GetSafeString(ord++);
                    a.Email        = reader.GetSafeString(ord++);
                    a.AspNetUserId = reader.GetSafeString(ord++);
                    a.TotalRows    = reader.GetSafeInt32(ord++);
                    a.hasUsr       = reader.GetSafeBool(ord++);
                    a.hasMgr       = reader.GetSafeBool(ord++);
                    a.hasAdm       = reader.GetSafeBool(ord++);

                    if (list == null)
                    {
                        list = new List <AspNetUserRole>();
                    }

                    list.Add(a);
                    break;
                }
            }
                                    );

            return(list);
        }