DocSpace-buildtools/common/ASC.Api.Core/Routing/FormatRoute.cs
pavelbannov 5022501e58 Merge branch 'feature/backend-refactor' into feature/asc-api-core-refactor
# 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
2022-02-10 13:56:54 +03:00

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)
{ }
}