コード例 #1
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound("Id can NOT be null"));
            }

            var report = await _reportServices.GetReport(id.Value);

            if (report == null)
            {
                return(NotFound("Report not found."));
            }

            ViewData["Tags"] = report.Tags.Split(',').Select(t => t.Trim());

            return(View(report));
        }
コード例 #2
0
        public async Task <IActionResult> Remove(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var report = await _reportServices.GetReport(id.Value);

            if (report == null)
            {
                return(NotFound());
            }

            return(View(report));
        }
コード例 #3
0
        public async Task <IActionResult> Approve(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var report = await _reportServices.GetReport(id.Value);

            if (report == null)
            {
                return(NotFound());
            }
            await _reportServices.ApproveReport(id.Value);

            var subscribedEmails = await _userServices.GetSubscribedUsers(report.Industry);

            if (subscribedEmails.Length > 0)
            {
                _emailSenderServices.AutoSendMail(subscribedEmails);
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #4
0
        public async Task <IActionResult> Get(int id)
        {
            var model = await _reportServices.GetReport(id);

            return(Ok(model));
        }