예제 #1
0
 public IActionResult Resources()
 {
     try {
         return(Ok(_commonResource.GetResources()));
     } catch (System.Exception ex) {
         _logger.LogInformation("Unable to get Resources, {}", ex);
         return(NotFound());
     }
 }
예제 #2
0
        public async Task <IActionResult> OnGetAsync()
        {
            HopeLineUser CurrentUser = await _userManager.GetUserAsync(User);

            if (CurrentUser != null)
            {
                if (CurrentUser.AccountType == DataAccess.Entities.Account.User || CurrentUser.AccountType == DataAccess.Entities.Account.Guest)
                {
                    isUser = true;
                }
                else
                {
                    isUser = false;
                }
            }
            else
            {
                isUser = true;
            }

            Resources = _commonResource.GetResources().Select(r => new ResourcesViewModel
            {
                Id          = r.Id,
                Name        = r.Name,
                Description = r.Description,
                URL         = r.URL,
                ImageURL    = r.ImageURL
            }).ToList();

            foreach (var i in Resources)
            {
                if (i.Id > 99 && i.Id < 200)
                {
                    DepressionRes.Add(i);
                }
                else if (i.Id > 199 && i.Id < 300)
                {
                    AnxietyRes.Add(i);
                }
                else if (i.Id > 299 && i.Id < 400)
                {
                    BullyingRes.Add(i);
                }
                else if (i.Id > 399 && i.Id < 500)
                {
                    SuicideRes.Add(i);
                }
            }

            return(Page());
        }
예제 #3
0
        public async Task <IActionResult> CreateResources()
        {
            if (_commonResource.GetResources().Count() == 0)
            {
                var resources = new List <ResourceModel> {
                    new ResourceModel {
                        Name        = "A Self-Help Guide to Dealing with Depression",
                        Description = "While treating major depressive disorder will generally require professional intervention, there are ways for you to take some control over your condition. Here are eight self - help techniques or alternative therapies that can help you cope with depression, get a handle on your symptoms, and beat the disease altogether.",
                        URL         = "https://www.healthline.com/health/depression/self-help-guide-to-depression",
                        ImageURL    = "https://i0.wp.com/www.healthline.com/hlcmsresource/images/topic_centers/2018-9/sad_woman-732x549-thumbnail.jpg?w=420"
                    },
                    new ResourceModel {
                        Name        = "8 Tips for Living With Depression",
                        Description = "Everything feels more challenging when you're dealing with depression. Going to work, socializing with friends, or even just getting out of bed can feel like a struggle.",
                        URL         = "https://www.verywellmind.com/tips-for-living-with-depression-1066834",
                        ImageURL    = "https://www.verywellmind.com/thmb/LM__5ShPLF0KDU87LU6d1T5ZtA4=/2121x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/GettyImages-643325030-5aa2c1dea18d9e00382419f9.jpg"
                    },
                    new ResourceModel {
                        Name        = "Self-Help Methods For Major Depression",
                        Description = "Thus far in this document, we've described therapies that are generally best prescribed and monitored by clinical professionals. However, it is also possible to take a self-help approach to the treatment of depression under certain circumstances. Self-help approaches emphasize what people can do for themselves rather than what professionals can offer.",
                        URL         = "https://www.mentalhelp.net/articles/self-help-methods-for-major-depression/",
                        ImageURL    = "https://www.mentalhelp.net/content/uploads/2015/10/xmentalhelp-shutterstock276465491-meditation-feature_image.jpg.pagespeed.ic.dsYV_Coszg.webp"
                    },
                    new ResourceModel {
                        Name        = "How to Stop Worrying",
                        Description = "Everyone worries. Worrying can even be helpful when it spurs you to take action and solve a problem. But if you're preoccupied with 'what ifs' and worst-case scenarios, worry becomes a problem. Unrelenting anxious thoughts and fears can be paralyzing. They can sap your emotional energy, send your anxiety levels soaring, and interfere with your daily life. But chronic worrying is a mental habit that can be broken. You can train your brain to stay calm and look at life from a more balanced, less fearful perspective.",
                        URL         = "https://www.helpguide.org/articles/anxiety/how-to-stop-worrying.htm",
                        ImageURL    = "https://www.helpguide.org/images/anxiety/woman-eyes-closed-hand-on-temple-500.jpg"
                    },
                    new ResourceModel {
                        Name        = "How to Improve Self-Esteem With Generalized Anxiety Disorder",
                        Description = "People who struggle with generalized anxiety disorder (GAD) often find themselves struggling with low self-esteem. They may have poor confidence in themselves or think they are worthless.",
                        URL         = "https://www.verywellmind.com/anxiety-and-self-esteem-1393168",
                        ImageURL    = "https://www.verywellmind.com/thmb/rkcN4BF9ygcZtYySVMM6ol2K0s4=/768x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/GettyImages-530626911-56da37d83df78c5ba03a6777.jpg"
                    },
                    new ResourceModel {
                        Name        = "7 tips to help with stress and anxiety",
                        Description = "It��s totally normal to feel stressed or anxious from time to time, but there��s lots of things you can do to feel a bit better. Remember: there��s a difference between feeling stressed every now and then, and experiencing ongoing anxiety.",
                        URL         = "https://au.reachout.com/articles/7-tips-to-help-with-stress-and-anxiety",
                        ImageURL    = "http://www.daytonreachout.org/images/reachoutlogo2.jpg",
                    },
                    new ResourceModel {
                        Name        = "Ways to take care of yourself if you're being bullied",
                        Description = "If you��re experiencing bullying, looking after yourself can help you reduce your stress and feel more positive and hopeful. We chatted to a bunch of young people who��d experienced bullying and they shared their own self-care tips.",
                        URL         = "https://au.reachout.com/articles/ways-to-take-care-of-yourself-if-youre-being-bullied",
                        ImageURL    = "http://www.daytonreachout.org/images/reachoutlogo2.jpg"
                    },
                    new ResourceModel {
                        Name        = "Bullying and Cyberbullying",
                        Description = "How to Deal with a Bully and Overcome Bullying",
                        URL         = "https://www.helpguide.org/articles/abuse/bullying-and-cyberbullying.htm",
                        ImageURL    = "https://www.helpguide.org/images/abuse/redheaded-girl-chin-to-knee-500.jpg"
                    },
                    new ResourceModel {
                        Name        = "THINKING ABOUT SUICIDE?",
                        Description = "There are many crisis centres available 24 hours a day to talk to you.",
                        URL         = "https://suicideprevention.ca/need-help/",
                        ImageURL    = "https://suicideprevention.ca/resources/Pictures/CASP.png"
                    },
                    new ResourceModel {
                        Name        = "The Nature Of Suicide",
                        Description = "This introductory document discusses suicide; the taking of one's own life. It is intended to educate readers about the nature of suicide.",
                        URL         = "https://www.mentalhelp.net/articles/about-the-nature-of-suicide/",
                        ImageURL    = "https://www.mentalhelp.net/content/uploads/2018/02/mentalhelp-shutterstock1014834241-group-therapy-session.jpg"
                    }
                };
                foreach (var item in resources)
                {
                    _commonResource.AddResources(item);
                }
                await _commonResource.SaveCommunityAsync();

                return(Ok("Data Newly Populated"));
            }
            return(Ok("Data Already Added"));
        }