init
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adminisztracio.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.IsFeltarAlkalmazott.ClaimValue)]
|
||||
[ApiRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
public class FeltarAlkalmazottApiController : ApiController
|
||||
{
|
||||
private readonly IFileServiceHelper fileServiceHelper;
|
||||
private readonly ICoreApiClient coreApiClient;
|
||||
|
||||
public FeltarAlkalmazottApiController(IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient)
|
||||
{
|
||||
this.fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
|
||||
this.coreApiClient = coreApiClient ?? throw new ArgumentNullException(nameof(coreApiClient));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public bool IsEszkozIgenyelheto()
|
||||
{
|
||||
return new FeltarAlkalmazottHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).IsEszkozIgenyelheto(ClaimData.FelhasznaloId);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage EszkozIgenyles(FeltarAlkalmazottCo feltarAlkalmazott)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (feltarAlkalmazott.AdatvedelmiTajekoztatoElfogadasa && feltarAlkalmazott.AltalanosSzerzodesiFeltetelekElfogadasa && IsEszkozIgenyelheto())
|
||||
{
|
||||
new FeltarAlkalmazottHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).EszkozIgenyles(ClaimData.FelhasznaloId);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.BadRequest);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NemSikerultAMuvelet) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user