kreta/KretaWeb/Areas/OsztalyCsoport/ApiControllers/AmiAktTanevSorolasApiController.cs
2024-03-13 00:33:46 +01:00

173 lines
6.8 KiB
C#

namespace Kreta.Web.Areas.OsztalyCsoport.ApiControllers
{
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Core.Exceptions;
using Kreta.Enums;
using Kreta.Web.Areas.OsztalyCsoport.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Helpers.Error;
using Kreta.Web.Security;
[ApiRoleClaimsAuthorize(true)]
[ApiRolePackageAuthorize(KretaClaimPackages.AMImodul.ClaimValue)]
public class AmiAktTanevSorolasApiController : ApiController
{
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyBesorolasElsoAlkalom(AktTanevOsztalyBesorolasElsoAlkalomModel model)
{
if (model.EgyeniCsoportAutoLetrehozas)
{
model.EgyeniCsoportAutoLetrehozas = new OsztalyCsoportHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetOsztalyokByMuveszetiAg(MuveszetiAgEnum.ZenemuveszetiAg).Contains(model.ToDDL.Value);
}
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiOsztalybaSorolasElsoAlkalommal(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyKisorolas(AktTanevOsztalyKisorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiOsztalyKisorolas(model, model.ConvertModelToJogviszonyCo());
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage OsztalyTevesBesorolasJavitas(AktTanevOsztalyTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiOsztalybaSorolasJavitasa(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportAtsorolas(AktTanevCsoportAtsorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiCsoportbaAtsorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportBesorolas(AktTanevCsoportBesorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiCsoportbaSorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusError(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportKisorolas(AktTanevCsoportKisorolasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiCsoportbolKisorolas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
[HttpPost]
[ApiValidateAjaxAntiForgeryToken]
public HttpResponseMessage CsoportTevesBesorolasJavitas(AktTanevCsoportTevesBesorolasJavitasModel model)
{
try
{
new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID).AmiCsoportSorolasJavitas(model);
}
catch (BlException ex)
{
var error = StatusErrorFactory.GetSorolasStatusErrorWithReloadDDL(ex.Message);
if (ex.IsUnHandled)
{
error.UnHandledException = ex.InnerException;
}
throw error;
}
return new HttpResponseMessage(HttpStatusCode.OK);
}
}
}