Krzak
Krzak
CC#
Created by Krzak on 7/4/2024 in #help
Learning how to test API with NUnit and Nsubstitute
I have nooo idea what's going on :OhNo:
22 replies
CC#
Created by Krzak on 7/4/2024 in #help
Learning how to test API with NUnit and Nsubstitute
I'll try that out, looks way more friendly. Will this be useful for testing a web app too or is something else used? The API is used by the web app so it looks like it needs a similar technique to provide needed data without asking the real database
22 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
and I can't use <a href=""> because I don't know the exact links and I'd have to download the entire page's source anyway
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
so like, attach an event that'd send a request but that seems to not be possible
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
I thought that I could just make them clickable and get informations about the selected movie from the dubbingpedia
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
it works just fine but uh oh now I see that a list isn't clickable the same way a button is?
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
(it's a smol brain day today, sorry)
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
In a list maybe?
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
just wondering, how to store them since they won't be named?
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
Anyway my first guess to make things easy would be to make each of the movies a separate object but maybe there's a better way
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
I'm not sure if it's even a good idea because I'd have to make the call for each of the movies for the production date and that seems like a lot of traffic, I tried to find a different API but filmweb isn't publicly available and imdb is restricted, I'm not exactly a movie person .-. unleeessss wikipedia?
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
I have a model class for deserializing this too
15 replies
CC#
Created by Krzak on 7/4/2023 in #help
❔ ✅ Manipulating JSON
{
"batchcomplete": "",
"continue": {
"sroffset": 10,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 12
},
"search": [
{
"ns": 0,
"title": "Shrek",
"pageid": 357,
"size": 4924,
"wordcount": 615,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span>\n|plakat= <span class='searchmatch'>Shrek</span>.jpg\n",
"timestamp": "2023-05-15T13:10:47Z"
},
{
"ns": 0,
"title": "Shrek 2",
"pageid": 358,
"size": 4836,
"wordcount": 623,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span> 2\n|plakat= <span class='searchmatch'>Shrek</span> 2.jpg\n",
"timestamp": "2023-06-10T15:32:33Z"
},
{
"ns": 0,
"title": "Shrek Trzeci",
"pageid": 359,
"size": 5924,
"wordcount": 685,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span> Trzeci\n|tytuł oryginalny= <span class='searchmatch'>Shrek</span> the Third\n",
"timestamp": "2023-05-15T17:50:21Z"
},
//I had to shorten the message, there's only more titles below
]
}
}
{
"batchcomplete": "",
"continue": {
"sroffset": 10,
"continue": "-||"
},
"query": {
"searchinfo": {
"totalhits": 12
},
"search": [
{
"ns": 0,
"title": "Shrek",
"pageid": 357,
"size": 4924,
"wordcount": 615,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span>\n|plakat= <span class='searchmatch'>Shrek</span>.jpg\n",
"timestamp": "2023-05-15T13:10:47Z"
},
{
"ns": 0,
"title": "Shrek 2",
"pageid": 358,
"size": 4836,
"wordcount": 623,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span> 2\n|plakat= <span class='searchmatch'>Shrek</span> 2.jpg\n",
"timestamp": "2023-06-10T15:32:33Z"
},
{
"ns": 0,
"title": "Shrek Trzeci",
"pageid": 359,
"size": 5924,
"wordcount": 685,
"snippet": "|tytuł= <span class='searchmatch'>Shrek</span> Trzeci\n|tytuł oryginalny= <span class='searchmatch'>Shrek</span> the Third\n",
"timestamp": "2023-05-15T17:50:21Z"
},
//I had to shorten the message, there's only more titles below
]
}
}
15 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
Is it just how the template is made? I thought that for each view there has to be a separate controller and they just "meet" in that main window
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly HttpClient _httpClient = new HttpClient();


public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}

public IActionResult Index()
{

return View();
}

public IActionResult Privacy()
{
return View();
}
// other stuff
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly HttpClient _httpClient = new HttpClient();


public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}

public IActionResult Index()
{

return View();
}

public IActionResult Privacy()
{
return View();
}
// other stuff
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</li>
</ul>
</div>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</li>
</ul>
</div>
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
And there's another thing now. I have a "search bar" where the user inputs a movie title. This title is then pasted into a url and I receive a result of this search, a list of movies. I want to display them as a list so I made a new view for this. The template project has a similar thing, two views can be selected from a menu. What I don't understand is that they're connected to Home controller like this
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
btw since that's a template and has a looot of weird files, how do I deal with uploading it on github? I'm sure I'll break something if I'll try to remove seemingly unnecessary files but on the other hand it doesn't feel right to just send all of them there.
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
in the meantime it turned out I was using the wrong template so that explains some of the confusion
24 replies
CC#
Created by Krzak on 6/28/2023 in #help
✅ App advice before starting writing anything
I read that it's better to move API related stuff to Services but I'm not sure if this makes sense in such a small scale project
24 replies