Exemplo n.º 1
0
        public HttpResponseMessage SearchUser([FromBody] UserSearchViewModel userdata)
        {
            decimal?active;

            if (userdata.active != null)
            {
                active = userdata.active == true ? 1 : 0;
            }
            else
            {
                active = null;
            }

            ObjectResult <SEC_USERS_GET_Result> users = db.SEC_USERS_GET(userdata.mobile, null, userdata.email,
                                                                         userdata.username, null, active, null, null,
                                                                         userdata.usertype, userdata.deptno, userdata.designo, userdata.hrid,
                                                                         userdata.fullname, null, null, null, 1, 10);

            var result = users.Select(u => new {
                userno   = (int)u.USER_NO,
                usertype = (int)u.USER_TYPE_NO,
                compno   = u.COMP_NO,
                deptno   = u.DEPT_NO,
                designo  = u.DESIG_NO,
                hrid     = u.HR_EMP_ID,
                fullname = u.USER_FULL_NAME,
                mobile   = u.USER_MOBILE,
                email    = u.USER_EMAIL,
                username = u.USER_NAME,
                active   = u.IS_ACTIVE,

                nickname   = u.USER_NICK_NAME,
                word       = u.USER_PWD,
                contact    = u.USER_CONTACT,
                address    = u.USER_ADDR,
                activefrom = u.ACTIVE_FROM.ToString(),
                activeto   = u.ACTIVE_TO.ToString()
            });

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }