morry329#
Edit function does not work
So I would like a second set of eyes. I wanted to try editing the pre-existing record on my card view (see the screenshot attached) like Beachfront Villa -> Beachfront Villa 8. Even this easy modification does not succeed, as on clicking the save button I got "record not found"
And this comes from here in the controller
and this is what the frontend devtool says: https://imgur.com/a/xs8LLlD
my database has not the id "1" referred in that devtool:
`
my save button on View should have been picking up any ids listed here (5,6, or 74) but as the devtool shows it picks up 1 instead. i suppose if it picks up 5,6,74 it will let me edit the ListingName property.
so could anyone kindly point me in the right direction? Relevant code snippets here https://pastebin.com/9U9zjvaG
20 replies
✅ always gets the invalid data received
I have been creating a simple CRUD app with the ASP.NET. My update function does not work as expected: the save button triggers the error message "invalid data received" ; somehow the model reference is considred null on clicking the save button
could anyone kindly advice me on why the save button does not save the user input as expected? the full code here https://pastebin.com/4C2aYF78
2 replies
Insert Method does not insert or save the user input as wanted
I have a working UI with a text field to enter a property name like "Ca* Oro Bridge" on my MVC view. The save button is also displayed on the view. Onclick it does not save the userinput in the text field (henceforth it is also not saved in the DB). I have debugged the follwing code responsible for handling user inputs
`
I am not versed in the world of debugging, but it looks like the HttpGet method refers or returns null. InsertListing method (HttpPost method) deems it as !ModelState.Isvalid (which means my code does not save the input at all)
Now I don't quite understand what caused all this null and invalidity. https://pastebin.com/DhCg4Md2
Can anyone kindly point me in the right direction?
1 replies
Does it make sense to two references (to database migration and data seeding) in the same using
I am totally new to this, so I rely on chatGPT a lot
With the help of GPT I have wrote a code like this
As you see this is the Program.cs snippet (ASP.NET Core 7). My concern is that this code might make no sense to have db.Database.Migrate(); and seeder.SeedModels(); under the same roof (the same
What do you all think of this snippet?
using
). I don't know much about all this ASP.NET world but I migrated database a couple of times via the commandline like dotnet ef add-migration
etc. so I started wondering if db.Database.Migrate();
in Program.cs makes any sense.What do you all think of this snippet?
6 replies
MySqlException: Column 'Age' cannot be null
So this error occured in the following scenario: I have created a simple ASP.NET Core web app with some simple db configurations. On running dotnet run from Rider, the browser displayed my web app (a login form). I have click "register a new user". Then I was redirected to a register form page with three textfields , email, password and repeat password. I filled in all of them and hit register. Now I was bugged with this bunch of exception texts https://pastebin.com/7DqbUai5
I don't understand this error Column 'Age' cannot be null. I made extra sure that my DB has the column Age with non-null values like this:
`
For your reference this is the link to the codes https://pastebin.com/k88fKn7r
Could anyone point me in the right direction?
I want to solve this error but I need another set of eyes
PS: I am just thinking that this error may refer to the column Age which belongs to another table from another DB. The output displayed here came from the table PortalUser in the searchhome DB, but I may have another PortalUser table in my second DB. If that is the case will this error point to that another PortalUser which may have no column values? Hope all this makes sense.
7 replies
MySqlException: Field 'CreatedOnUtc' doesn't have a default value
So I have been creating a very simple ASP.NET Core application lately with a simple mariaDB configuration and nginx
Once the dotnet run has been typed, a web app pops up on Chrome prompting me to enter login credentials. As the combination of root-root (for both of username and password) is not allowed there, I opted to create a new user.
The web app now prompted me to create brand new credentials (email, password, username). Once those have been entered and the submit button has been hit, the following error got triggered
https://pastebin.com/GrcSaHQZ
I tried to find that field in question:
MySqlException: Field 'CreatedOnUtc' doesn't have a default value
ChatGPT gave me this collection of potential fixes https://pastebin.com/nUDiybVk but none of them could not find that field/column CreatedOnUtc
Would it be a good idea to create that column on my db with the default value? Do you have any other idea how to fix this error??4 replies
MySqlException: Table 'searchhome.aspnetusers' doesn't exist
So I wanted to do the following: I have already created a simple database with a table. On that db table some values have been added. I wanted to display that added value on my simple ASP.NET Core app. However, the dotnet run gave me the error as per screenshot attached
(aspnetusers does not exist)
The dotnet ef database update
leads to the same error (aspnetusers does not exist). I have tried adding that aspnetuser table or tried updating the database( INSERT INTO
__EFMigrationsHistory (
MigrationId,
ProductVersion) VALUES ('00000000000000_CreateIdentitySchema', '7.0.2');
)
None of these helped me out.
All my codes are here https://pastebin.com/kdgjhGTu
Could anyone kindly point me in the right direction??16 replies
Dealing with the professor: advice appreciated
Hi all I would like some inputs to deal with the oral exam / the nasty professor.
I just had to deal with him during one of his oral exams and in two weeks I have the other oral exam with him. I will describe what exactly was the problem. Any advice as to how to ace the exam appreciated.
Problem: the 20 minutes is the standard time for all the exams which that Prof is in charge of. He does not make use of it effectively: the entire exam time he was the one who mostly did the talking. I tried to just talk to myself to show them what I learned but his interruption won the race. Even though I answered his questions correctly he said I had to answer the same question again to which I was like "gosh I just told you have you not heard it? "
At the tail end of this exam I went on to explain the quick summary of the subject matters to the third examiner. Like "so you can use this app to record your medical checkups, you log into the app and your personal data is stored in the DB which is the integral part of the three tier architecture. This architecture is (the Prof blocked me).
I will see if those few minutes of quick app ran down will save my grade.
But how would you all behave if you were in my shoes? I have another one for another class with the same professor. Any advice for getting my point across better appreciated
TL:DR A prof did not dare to listen to me during my oral exam, I resorted to interrupt him and just talk to myself. How could I deal with him better next time so I could finish my sentences ?
13 replies
IndexOutOfBoundsException triggered | LeetCode Where will the ball fall
Link to the puzzle description https://leetcode.com/problems/where-will-the-ball-fall/description/
I have been fighting with this puzzle for more than a month. Still my code cannot output correctly.
I tried this testcase
Input: grid = [[1,1,1,-1,-1],[1,1,1,-1,-1],[-1,-1,-1,1,1],[1,1,1,1,-1],[-1,-1,-1,-1,-1]]
Output: [1,-1,-1,-1,-1]
And my WIP code (it triggers IndexOutOfBoundsException at line int currRow = 0
. Could anyone kindly point me in the right direction?:
7 replies
A small hiccup for the LeetCode puzzle Where the ball will fall
Link to the original puzzle https://leetcode.com/problems/where-will-the-ball-fall/
My code does not print out the right output just yet
The output is
-1, -1, -1, -1 whilst it is supposed to be
1, -1, -1, -1, -1. The input here is
grid = [[1,1,1,-1,-1],[1,1,1,-1,-1],[-1,-1,-1,1,1],[1,1,1,1,-1],[-1,-1,-1,-1,-1]]`
Could anyone kindly point me in the right direction?1 replies
Not able to pass the test case correctly
The link to the original task https://leetcode.com/problems/where-will-the-ball-fall/
This is my WIP code
The output for this code is
==> -1 ==> -1 ==> -1 ==> -1 ==> -1
But it was supposed to be
==> 1 ==> -1 ==> -1 ==> -1 ==> -1` instead
I don't understand why my code stores -1 instead of 1 at the first index on my array. Could anyone kindly point me in the right direction?3 replies
Create Migration always fail
So I wanted to create a SQL Server database table based on your C# model. I have typed down
dotnet ef migrations add InitialCreate
but it never gets to migrate. The dotnet build
shows no noticeable errors like this
`
The link to all other database-related code https://pastebin.com/qFyNtM04
Could anyone point me in the right direction?4 replies