Answer the question
In order to leave comments, you need to log in
Junior ASP.NET MVC interview test, need help?
Hello! I would appreciate any help and advice. The situation is this: the company gave a test background before an interview for a Junior ASP.NET MVC Developer. Verbatim:
"Develop an ASP.Net MVC application with one page that has a textbox for a message and a button. By clicking on the button, the message is sent and stored on the server (storage of messages should work offline, without using a database server). Implement the ability to view the messages of the current user and all users of the system.Make a page for displaying all user messages with sorting user messages by ID or time.On the server, the last 10 messages (by default) for each user and the last 20 messages (by default) for all users are stored. assigned an ID - either automatically or manually. Having at least a minimal design and the use of AJAX technologies is welcome.".
Regarding the phrase in the assignment. Namely: the storage of messages should work autonomously, without using a database server. Those. I understand it this way - messages should not be stored in storage in the database, but locally in the program, for example, in the Session object. But then I have a problem and I can’t implement viewing messages of all users with a specific one (you can only access the Session object of the current user, but you can’t access the object of another user), and as for displaying messages of one current user, then of course there are no problems . Maybe I'm not understanding correctly, or is it something else? In the project, I made forms authentication, and manually added users through Code First, as a result, the page is protected by authorization and each user has an id. What else can be used besides Session? How to be?
I would be grateful for any advice!
Answer the question
In order to leave comments, you need to log in
You can use SQLite or a similar embeddable database, you can also save to files. It is better to use SQLite in such cases. you can work with it like with a regular database.
Data can also be stored in an XML file. Serializing objects to xml using .NET is a trivial task.
"storing the message on the server" != "locally in the program" IIS can reload an application at any time.
If the whole difficulty lies in storing information not in the sql database, then the static storage defined in Global.asax comes to the rescue. It will be available anywhere in the application via MVCApplication.StorageName
Regarding the restrictions for each user and the general for users - either create a repository instance for each user - or cut the logic of adding and getting from the general one :) An interesting task for a junior :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question