Exemple #1
0
        public UserDetailsMV getUserDetails(int userID)
        {
            UserDetailsMV userDetails = new UserDetailsMV();

            using (ErrorLoggerDBContext context = new ErrorLoggerDBContext())
            {
                try
                {
                    var user = context.Users.Where(x => x.UserId.Equals(userID)).First();
                    if (user != null)
                    {
                        userDetails.UserID             = user.UserId;
                        userDetails.Email              = user.loginDetails.emailID;
                        userDetails.Role               = user.roleID;
                        userDetails.FirstName          = user.firstName;
                        userDetails.LastName           = user.lastName;
                        userDetails.Status             = user.statusText;
                        userDetails.lastLoginTimestamp = user.lastLoginTimestamp;
                        foreach (Application a in user.Applications)
                        {
                            userDetails.applications.Add(a.applicationName);
                        }
                    }
                }
                catch
                {
                    Log.Error("Function: getUserDetails CustomizeDeveloperMessage: Not able to retireve User details. Database Error. ");
                    throw new Exception("CustomizeDeveloperMessage: Not able to retireve User details. Database Error.");
                }
            }
            return(userDetails);
        }
Exemple #2
0
        // GET: admin/viewUserDetails
        public ActionResult viewUserDetails(int userID)
        {
            MvcApplication.logger.log("Controller: Admin Action: View User details Method: GET Info: Function Entered", 1);
            UserDataHandler dataSource = new UserDataHandler();
            UserDetailsMV   user       = dataSource.getUserDetails(userID);

            if (user == null)
            {
                MvcApplication.logger.log("Controller: Admin Action: View User details Method: GET Error: Check User ID", 3);
                throw new Exception("CustomizeDeveloperMessage: Not able to retireve User details. Check, User ID.");
            }
            return(View(user));
        }