public IHttpActionResult Getemployee()
        {
            thisEmp e = new thisEmp();

            e = q.GetCurrentEmployee();

            return Ok(e);
        }
Example #2
0
        /// <summary>
        /// currentEmployeeController
        /// Get User Info, incl. role for authorization in front end
        /// </summary>
        /// <returns></returns>
        public thisEmp GetCurrentEmployee()
        {
            thisEmp em = new thisEmp();
            if (username != "")
            {
                int empId = GetUserId();

                var emp = (from e in db.employees
                           from au in db.AspNetUsers
                           from ur in db.userroles
                           where e.eid == au.employee_eid
                           where e.userrole_urid == ur.urid
                           where e.eid == empId
                           select new thisEmp
                           {
                               userrole = ur.userrole1,
                               name = e.name,
                               username = au.UserName,
                               eid = e.eid
                           }).FirstOrDefault();

                return emp;

            }
            else
            {
                return em;
            }
        }