Example #1
0
        /// <summary>
        /// Get a list of chats.
        /// </summary>
        /// <param name="userId">
        /// The id of the user that requests the list of chats.
        /// </param>
        /// <returns>
        /// A list of chats for the specific user id.
        /// </returns>
        /// <remarks>
        /// List consists of ChatModel objects with Application.Id as Id, HelpRequest.Title as Title and Application.Status as Status.
        /// Different user roles get different lists.
        /// </remarks>
        public List <ChatModel> List(UserModel user)
        {
            switch (user.Role)
            {
            case UserRole.Admin:
                return(context.List());

            case UserRole.AidWorker:
                return(context.ListAsAidWorkerUser(user.Id));

            case UserRole.HelpSeeker:
                return(context.ListAsHelpSeeker(user.Id));

            case UserRole.Volunteer:
                return(context.ListAsVolunteer(user.Id));

            default:
                return(null);
            }
        }