Пример #1
0
        public async Task <IActionResult> Add(Issue issue)
        {
            // default message
            var result = "Could't add Issue record.";

            if (!string.IsNullOrEmpty(issue.Description))
            {
                // complete the model and add to db
                issue.Complete(await _userManager.GetUserAsync(User));
                await _db.Issues.AddAsync(issue);

                // log for admin
                await _db.Logs.AddAsync(await Log.New("Issue", $"Issue: \"{issue.Description}\", was CREATED", _id, _db));

                result = $"Issue record \"{issue.Description}\" was created.";
            }
            return(RedirectToAction("Dashboard", "Admin", new { message = result }));
        }