Example #1
0
        public ActionResult ListChat(int id)
        {
            var member = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(member.Id, id))
                {
                    if (Request.IsAjaxRequest())
                    {
                        return(Json(new { success = false }));
                    }
                    return(RedirectToAction("Index"));
                }

                var chats = sl.GetChatList(id);

                var vmchats = ConvertToChatViewModelList(chats, member.Id);

                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true, chats = vmchats }));
                }
                return(RedirectToAction("Details", new { id = id }));
            }
        }