Refactored AdminController and AuthService to use primary constructor syntax, removing explicit field declarations. Updated logging to use structured logging across controllers and services. Added XML documentation for methods in AdminController, AuthController, AuthService, and MailService. Modified Program.cs to improve connection string handling and Swagger setup. Removed deprecated service files.
24 lines
991 B
C#
24 lines
991 B
C#
using PortBlog.API.Services.Contracts;
|
|
using Razor.Templating.Core;
|
|
|
|
namespace PortBlog.API.Services
|
|
{
|
|
/// <summary>
|
|
/// Provides functionality to render Razor view templates with a specified model.
|
|
/// </summary>
|
|
public class TemplateService : ITemplateService
|
|
{
|
|
/// <summary>
|
|
/// Renders a Razor view template at the specified path using the provided model.
|
|
/// </summary>
|
|
/// <typeparam name="T">The type of the model to pass to the view.</typeparam>
|
|
/// <param name="viewPath">The path to the Razor view template.</param>
|
|
/// <param name="model">The model to use when rendering the view.</param>
|
|
/// <returns>A task that represents the asynchronous operation. The task result contains the rendered view as a string.</returns>
|
|
public async Task<string> GetViewTemplate<T>(string viewPath, T model)
|
|
{
|
|
return await RazorTemplateEngine.RenderAsync(viewPath, model);
|
|
}
|
|
}
|
|
}
|