Bug managment : deletions
This commit is contained in:
@ -27,9 +27,12 @@ namespace Yavsc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET: Bug
|
// GET: Bug
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index(int skip = 0, int take = 25)
|
||||||
{
|
{
|
||||||
return View(await _context.Bug.ToListAsync());
|
if (take > 50) return BadRequest();
|
||||||
|
ViewData["skip"]=skip;
|
||||||
|
ViewData["take"]=take;
|
||||||
|
return View(await _context.Bug.Skip(skip).Take(take).ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Bug/Details/5
|
// GET: Bug/Details/5
|
||||||
@ -135,6 +138,8 @@ namespace Yavsc.Controllers
|
|||||||
return View(bug);
|
return View(bug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// POST: Bug/Delete/5
|
// POST: Bug/Delete/5
|
||||||
[HttpPost, ActionName("Delete")]
|
[HttpPost, ActionName("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
@ -168,10 +173,10 @@ namespace Yavsc.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public async Task<IActionResult> DeleteAllLikeConfirmed(long id)
|
public async Task<IActionResult> DeleteAllLikeConfirmed(long id, int prefixLen = 25)
|
||||||
{
|
{
|
||||||
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
Bug bug = await _context.Bug.SingleAsync(m => m.Id == id);
|
||||||
var bugs = await _context.Bug.Where(b => b.Description == bug.Description).ToArrayAsync();
|
var bugs = await _context.Bug.Where(b => b.Description.Substring(0, prefixLen) == bug.Description.Substring(0, prefixLen)).ToArrayAsync();
|
||||||
foreach (var btd in bugs)
|
foreach (var btd in bugs)
|
||||||
_context.Bug.Remove(btd);
|
_context.Bug.Remove(btd);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
@ -45,7 +45,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||||
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||||
<a asp-action="DeleteAllLike" asp-route-id="@item.Id">Delete</a>
|
<form asp-action="DeleteAllLikeConfirmed" asp-route-id="@item.Id" method="POST">
|
||||||
|
<input class="btm btm-primary" type="submit" value="Delete"></input>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,22 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
<dt>
|
<dt>
|
||||||
FeatureId"]
|
Feature Id
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@Html.DisplayFor(model => model.FeatureId)
|
@Html.DisplayFor(model => model.FeatureId)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
Title"]
|
Title
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@Html.DisplayFor(model => model.Title)
|
@Html.DisplayFor(model => model.Title)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
Status"]
|
Status
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@typeof(Yavsc.Models.IT.Fixing.BugStatus).GetEnumNames()[(int)Model.Status]
|
@Html.DisplayFor(model => model.Status)
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
[<a asp-action="DeleteAllLike" asp-route-id="@Model.Id">Delete all like this one</a> |
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index">Back to List</a>]
|
||||||
</p>
|
</p>
|
||||||
|
@ -146,7 +146,8 @@ $.widget("psc.blogcomment", {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
jQuery(function() {
|
||||||
$("[data-type='blogcomment']").blogcomment();
|
$("[data-type='blogcomment']").blogcomment();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user