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
How to see more Errors and information while debugging
Apr 2 2021 8:30 AM
Im trying to figure out a code that is not working
but I recieve no information even when i go to
Tools > options -> project and solutions -> build and run
I would like to see feedback from every step I take
In that way i can figure out how to fix the problem
right now i have no clue.
this is my code :
public
async Task<IActionResult> Create([Bind(
"ProductId,ProductTitle,ProductDiscription,Price,quantity,HeaderImage"
)] ProductWithImages productWithImages, ProductImages productImages)
{
Guid NewProductId = Guid.NewGuid();
string
uploadPath = Path.Combine(_webhostenv.WebRootPath,
"Images2"
);
if
(ModelState.IsValid)
{
string
FileName = Guid.NewGuid().ToString() + productWithImages.HeaderImage.FileName;
string
FilePath = Path.Combine(uploadPath, FileName);
productWithImages.HeaderImage.CopyTo(
new
FileStream(FilePath, FileMode.Create));
ProductWithImagesDb newproduct =
new
ProductWithImagesDb()
{
ProductId = NewProductId,
ProductTitle = productWithImages.ProductTitle,
ProductDiscription = productWithImages.ProductDiscription,
Price = productWithImages.Price,
quantity = productWithImages.quantity,
HeaderImage = FileName,
};
_context.Add(newproduct);
await _context.SaveChangesAsync();
return
RedirectToAction(nameof(Index));
}
return
View();
it skips the "
if
(ModelState.IsValid)"
While all field where filled (I get no red "asp-validation-for" warning text as wel)
and I get no error or information whatso ever
if you are an expert in coding you probably would see the problem
but as a beginner like me it makes it pretty difficult figering out problems
and to learn from those mistakes.
Reply
Answers (
2
)
if i’m doing c# web api, what is the design pattern for it? Is it mvc?
How to export datagridview to docx using interop c#?