コード例 #1
0
        public async Task <ActionResult> Index(UserChatModel paramUserInfo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    paramUserInfo._UserType      = UserChatModel.RegisteredUserType.regularUser;
                    paramUserInfo._GroupNameChat = Guid.NewGuid().ToString();

                    EmailModel emailService = new EmailModel();

                    //creates custom URL to access HelpDesk Login for users in service desk
                    string    urlWebDomain     = ConfigurationManager.AppSettings["WebDomain"];
                    UrlHelper uhelper          = new UrlHelper(ControllerContext.RequestContext);
                    string    urlHelpDeskLogin = urlWebDomain + uhelper.Action("HelpDeskLogin", "Chat", new { groupName = paramUserInfo._GroupNameChat });

                    //sends the email to helpdesk group
                    await emailService.CreatesUserStartSessionNotificationEmail(paramUserInfo, urlHelpDeskLogin);

                    return(RedirectToAction("ChatRoom", paramUserInfo));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = String.Format("Se ha presentado un problema al tratar de ingresar al chat. \n {0}", ex.Message);
                return(View());
            }
        }