Beispiel #1
0
        public async Task <IActionResult> Edit(Issue i)
        {
            // default message
            var result = "Could't edit Issue record.";

            if (ModelState.IsValid)
            {
                // update issue
                Issue issueToUpdate = await _db.Issues.FirstOrDefaultAsync(x => x.ID == i.ID);

                issueToUpdate.CopyInfo(i);
                _db.Issues.Update(issueToUpdate);

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

                result = $"Issue record was edited.";
            }

            return(RedirectToAction("Dashboard", "Admin", new { message = result }));
        }