C
C#14mo ago
Alberto

❔ Very easy question, about classes

Hi all, Im very new in Blazor, Im just doing a test for a company, if I pass it, they could be hiring me! Im this app I should use Blazor and make a service class for calling the API. Just calling a web that gives posts in a array. Then this class should be used by a Blazor component and show a table. Im actually doing everything inside a Blazor component and works well. My problem is how to separate everything, do I need a model for Post? How are the files separated? Mind that I come from JS and we do everything classless. (I can pay for support for the test)
4 Replies
L-I-V-E-2DAY
L-I-V-E-2DAY14mo ago
classes are used all the time in js... i've never used blazor so can't really help but you probably should be using classes in your js. depends on your exact use case I suppose
Playboi17
Playboi1714mo ago
What is this? A Blazor webassembly project where you are creating a service to call a api and a razor page to display the data? Yes you should have a model for the data, a dto. It would be easier to help if you share some snippets or a link to your repo
JakenVeina
JakenVeina14mo ago
yes, you will creat models to model your data, and they will take the form of classes in C#, the general convention is one class per-file, with files named after the class
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.