public async Task <IActionResult> Detailed(int?id)
 {
     if (id != null)
     {
         return(View(await repositoryHandler.GetEntryByIDAsync(id.Value)));
     }
     return(RedirectToAction("Index"));
 }
Beispiel #2
0
        public async Task <IActionResult> Detailed(int?id)
        {
            if (id != null)
            {
                var task = await repositoryHandler.GetEntryByIDAsync(id.Value, u => u.Reporter.FullName.Equals(User.Identity.Name) ||
                                                                     u.Assignee.FullName.Equals(User.Identity.Name) ||
                                                                     User.IsInRole(EmployeeRole.Admin.ToString()));

                if (task is null)
                {
                    return(new ContentResult {
                        StatusCode = 403, Content = "Forbidden", ContentType = "text/html"
                    });
                }

                return(View(task));
            }
            return(RedirectToAction("Index"));
        }