Ayin
Ayin
CC#
Created by Ayin on 1/10/2025 in #help
✅ Hosting MVC project on LINUX VPS using github actions
Hello, I have recently finished working on a website and would like to host it on VPS, have been researching about this and few things got me kind of curious. What I understood is that before hosting I should install ,NET SDK which contains kestrel and need to install Nginx as reverse proxy, which also seems simple to set up, but then starts the trouble to me, as far as I know I can't see actual desktop and can't install such tools as SSMS to make managing database, in such scenario, how am I supposed to create initial database and obtain ConnectionString? It's also downside that I can't manually interfere with database. Another thing is SSL, I found out that I need to use Certbot to get certificate and automatically renew it, are there no configurations needed other than just something like sudo certbot --nginx -d domain.com? and also, I am supposed to make first deployment with SSH? or do I need to make specific actions before that. Lastly, is it safe to save ConnectionString as environment variable?
10 replies
CC#
Created by Ayin on 4/27/2024 in #help
How things get to the place
I have found this one thing by Microsoft that confused me so much
public async Task<IActionResult> OnPostTryValidateAsync()
{
var modifiedReleaseDate = DateTime.Now.Date;
Movie.ReleaseDate = modifiedReleaseDate;

ModelState.ClearValidationState(nameof(Movie));
if (!TryValidateModel(Movie, nameof(Movie)))
{
return Page();
}

_context.Movies.Add(Movie);
await _context.SaveChangesAsync();

return RedirectToPage("./Index");
}
public async Task<IActionResult> OnPostTryValidateAsync()
{
var modifiedReleaseDate = DateTime.Now.Date;
Movie.ReleaseDate = modifiedReleaseDate;

ModelState.ClearValidationState(nameof(Movie));
if (!TryValidateModel(Movie, nameof(Movie)))
{
return Page();
}

_context.Movies.Add(Movie);
await _context.SaveChangesAsync();

return RedirectToPage("./Index");
}
Here, how did we get object of Movie? Method doesn't have any aprameters so I simply cannot get it
7 replies