TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
osyris zosar
NA
289
27.6k
Microsoft.EntityFrameworkCore.Database.Transaction: Error
Apr 15 2021 1:37 PM
View:
@model IEnumerable<Webshop.Models.Categorys>
<ul>
@foreach(
var
item
in
Model)
{
<li>@item.category
<a asp-action=
"DeleteCategory"
asp-route-id=
"@item.Id"
>Delete</a></li>
}
</ul>
Controller:
public
async Task<IActionResult> DeleteCategory(
int
Id)
{
if
(Id ==
null
)
{
return
NotFound();
}
var
findId = _context.Categorys.FirstOrDefault(x => x.Id == Id);
_context.Categorys.Remove(findId);
_context.SaveChangesAsync();
return
RedirectToAction(nameof(Category));
}
I have to press several times on the Delete link in order for it to work
when it doesnt work i get the error:
Microsoft.EntityFrameworkCore.Database.Transaction: Error: An error occurred using a transaction.
I would like to Understand why the code is not running smoothly
Thanks
Reply
Answers (
3
)
i want to combine two different query result in two different column
CSOM Library of ContentType or Get list of ContentTypes of a Library