using Microsoft.AspNetCore.Mvc;
namespace DigitalData.Core.API
{
///
/// Provides extension methods for controllers in ASP.NET Core applications.
/// This class is designed to enhance the functionality of , ,
/// and their related results such as .
///
public static class ControllerExtensions
{
///
/// Adds or updates a value in the ViewData dictionary of a ViewResult. This method supports fluent chaining,
/// enabling cleaner and more readable modifications to ViewData.
///
/// The ViewResult to which ViewData will be added or updated.
/// The key in the ViewData dictionary where the value will be stored.
/// The value to be stored in the ViewData dictionary.
/// The same ViewResult object with updated ViewData, allowing for additional chained operations.
public static ViewResult WithData(this ViewResult viewResult, string index, object value)
{
viewResult.ViewData[index] = value;
return viewResult;
}
}
}