pavelbannov
5022501e58
# Conflicts: # common/ASC.Api.Core/Auth/ConfirmAuthHandler.cs # common/ASC.Api.Core/Auth/CookieAuthHandler.cs # common/ASC.Api.Core/Core/ApiContext.cs # common/ASC.Api.Core/Core/ApiDateTime.cs # common/ASC.Api.Core/Core/BaseStartup.cs # common/ASC.Api.Core/Core/CustomHealthCheck.cs # common/ASC.Api.Core/Middleware/ProductSecurityFilter.cs # common/ASC.Api.Core/Middleware/TenantStatusFilter.cs # common/ASC.Api.Core/Model/EmployeeWraperFull.cs # common/ASC.Api.Core/Routing/FormatRoute.cs
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
namespace ASC.Web.Api.Routing;
|
|
|
|
public abstract class CustomHttpMethodAttribute : HttpMethodAttribute
|
|
{
|
|
public bool Check { get; set; }
|
|
public bool DisableFormat { get; set; }
|
|
|
|
protected CustomHttpMethodAttribute(string method, string template = null, bool check = true, int order = 1)
|
|
: base(new List<string>() { method }, $"[controller]{(template != null ? $"/{template}" : "")}")
|
|
{
|
|
Check = check;
|
|
Order = order;
|
|
}
|
|
}
|
|
|
|
public class ReadAttribute : CustomHttpMethodAttribute
|
|
{
|
|
public ReadAttribute(bool check = true, int order = 1) :
|
|
this(null, check, order)
|
|
{ }
|
|
|
|
public ReadAttribute(string template, bool check = true, int order = 1) :
|
|
base(HttpMethod.Get.Method, template, check, order)
|
|
{ }
|
|
}
|
|
public class CreateAttribute : CustomHttpMethodAttribute
|
|
{
|
|
public CreateAttribute(bool check = true, int order = 1) :
|
|
this(null, check, order)
|
|
{ }
|
|
|
|
public CreateAttribute(string template, bool check = true, int order = 1) :
|
|
base(HttpMethod.Post.Method, template, check, order)
|
|
{ }
|
|
}
|
|
public class UpdateAttribute : CustomHttpMethodAttribute
|
|
{
|
|
public UpdateAttribute(bool check = true, int order = 1) :
|
|
this(null, check, order)
|
|
{ }
|
|
|
|
public UpdateAttribute(string template, bool check = true, int order = 1) :
|
|
base(HttpMethod.Put.Method, template, check, order)
|
|
{ }
|
|
}
|
|
public class DeleteAttribute : CustomHttpMethodAttribute
|
|
{
|
|
public DeleteAttribute(bool check = true, int order = 1) :
|
|
this(null, check, order)
|
|
{ }
|
|
|
|
public DeleteAttribute(string template, bool check = true, int order = 1) :
|
|
base(HttpMethod.Delete.Method, template, check, order)
|
|
{ }
|
|
} |