init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
33
KretaWeb/Helpers/ApiUrlBuilder.cs
Normal file
33
KretaWeb/Helpers/ApiUrlBuilder.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace Kreta.Web.Helpers.Grid
|
||||
{
|
||||
public class ApiUrlBuilder
|
||||
{
|
||||
private readonly string Controller = nameof(Controller).ToLower();
|
||||
private readonly string Action = nameof(Action).ToLower();
|
||||
public string Route { get; private set; }
|
||||
public RouteValueDictionary RouteValues { get; private set; }
|
||||
|
||||
public ApiUrlBuilder(string controller, string action, IDictionary<string, object> parameters = null, string route = Constants.RouteKey.ActionApi)
|
||||
{
|
||||
var routeValues = new RouteValueDictionary
|
||||
{
|
||||
{ Controller, controller },
|
||||
{ Action, action }
|
||||
};
|
||||
|
||||
if (parameters != null)
|
||||
{
|
||||
foreach (var item in parameters)
|
||||
{
|
||||
routeValues.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
RouteValues = routeValues;
|
||||
Route = route;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue