init
This commit is contained in:
		| @@ -0,0 +1,46 @@ | ||||
| using System; | ||||
| using System.IO; | ||||
| using System.Net; | ||||
| using System.Security.Cryptography; | ||||
| using System.Web.Http; | ||||
| using Kreta.BusinessLogic.Helpers; | ||||
| using Kreta.Core.Logic; | ||||
| using Kreta.Resources; | ||||
| using Kreta.Web.Helpers; | ||||
| using Kreta.Web.Helpers.Error; | ||||
| using Kreta.Web.Security; | ||||
|  | ||||
| namespace Kreta.Web.Areas.Adminisztracio.ApiControllers | ||||
| { | ||||
|     [AllowAnonymous] | ||||
|     public class EmailKezelesApiController : ApiController | ||||
|     { | ||||
|         [HttpPost] | ||||
|         [ApiValidateAjaxAntiForgeryToken] | ||||
|         public IHttpActionResult Leiratkozas([FromBody] string data) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 Guid guid = Guid.Parse(UrlLogic.Decrypt(data, Core.Constants.EncryptionKey)); | ||||
|                 if (!new UzenetekHelper(ConnectionTypeExtensions.GetOrganizationConnectionType()).Leiratkozas(guid)) | ||||
|                 { | ||||
|                     throw new InvalidDataException(); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) when ( | ||||
|                 ex is ArgumentException || | ||||
|                 ex is CryptographicException || | ||||
|                 ex is FormatException || | ||||
|                 ex is InvalidDataException) | ||||
|             { | ||||
|                 throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.ErvenytelenAdat); | ||||
|             } | ||||
|             catch (Exception) | ||||
|             { | ||||
|                 throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.IsmeretlenHibaTortent); | ||||
|             } | ||||
|  | ||||
|             return Ok(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user