init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.KIR.Domain.Model;
|
||||
using Kreta.Core.KIR.Factory.Interface;
|
||||
using Kreta.Web.Areas.KirImportExport.Logic;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public abstract class BaseApiController : ApiController
|
||||
{
|
||||
protected internal IKirServiceFactory KirServiceFactory { get; }
|
||||
protected internal IKir2ServiceFactory Kir2ServiceFactory { get; }
|
||||
protected internal AuthHeaderModel AuthHeaderModel { get; }
|
||||
protected internal KirImportHelper KirImportHelper { get; }
|
||||
protected internal KirExportHelper2 KirExportHelper { get; }
|
||||
protected internal string KirKretaKodCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirKretaKod";
|
||||
protected internal string KirTokenCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirToken";
|
||||
protected internal readonly string KirPedagugisListCacheKey;
|
||||
protected internal readonly string KirTanuloListCacheKey;
|
||||
|
||||
protected internal BaseApiController(IKirServiceFactory kirServiceFactory, IKir2ServiceFactory kir2ServiceFactory)
|
||||
{
|
||||
KirServiceFactory = kirServiceFactory ?? throw new ArgumentNullException(nameof(kirServiceFactory));
|
||||
Kir2ServiceFactory = kir2ServiceFactory ?? throw new ArgumentNullException(nameof(kir2ServiceFactory));
|
||||
|
||||
if (Cache.Get($"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirLogin") is AuthHeaderModel authHeaderModel)
|
||||
{
|
||||
AuthHeaderModel = authHeaderModel;
|
||||
|
||||
var kirImportHelper = new KirImportHelper(kirServiceFactory, authHeaderModel);
|
||||
|
||||
KirPedagugisListCacheKey = $"{ClaimData.IntezmenyAzonosito}_{ClaimData.FelhasznaloId}_KirPedagugisList";
|
||||
KirTanuloListCacheKey = $"{ClaimData.IntezmenyAzonosito}_{ClaimData.FelhasznaloId}_KirTanuloList";
|
||||
|
||||
if (Cache.Get(KirKretaKodCacheKey) is string kretaKod && !string.IsNullOrWhiteSpace(kretaKod))
|
||||
{
|
||||
kirImportHelper.KretaKod = kretaKod;
|
||||
}
|
||||
|
||||
KirImportHelper = kirImportHelper;
|
||||
|
||||
if (HttpContext.Current.Request.UrlReferrer.AbsoluteUri.Contains("IndexExport"))
|
||||
{
|
||||
string kirToken = Cache.Get(KirTokenCacheKey) as string;
|
||||
|
||||
if (authHeaderModel.KirToken != kirToken)
|
||||
{
|
||||
authHeaderModel.KirToken = kirToken;
|
||||
}
|
||||
|
||||
AuthHeaderModel = authHeaderModel;
|
||||
|
||||
var kirExportHelper = new KirExportHelper2(kir2ServiceFactory, authHeaderModel, ClaimData.OrganizationCode, ClaimData.IntezmenyAzonosito);
|
||||
|
||||
KirExportHelper = kirExportHelper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetKirTelephelyList()
|
||||
{
|
||||
return Json(new KirImportLogic().GetKirTelephelyList(KirImportHelper));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.Core.Domain;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Core.KIR.Factory.Interface;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.KirImportExport.Logic;
|
||||
using Kreta.Web.Areas.KirImportExport.Models;
|
||||
using Kreta.Web.Areas.KirImportExport.Models.KirImport;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.ApiControllers
|
||||
{
|
||||
public class KirAlkalmazottImportApiController : BaseApiController
|
||||
{
|
||||
public KirAlkalmazottImportApiController(IKirServiceFactory kirServiceFactory, IKir2ServiceFactory kir2ServiceFactory) : base(kirServiceFactory, kir2ServiceFactory)
|
||||
{ }
|
||||
|
||||
public DataSourceResult GetKirAlkalmazottakGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var searchModel = JsonConvert.DeserializeObject<KirSearchModel>(data);
|
||||
KirSearchModel.ValidateModel(searchModel);
|
||||
new KirImportLogic().SetKirKretaKod(KirImportHelper, searchModel.KirTelephelyId.Value, KirKretaKodCacheKey);
|
||||
|
||||
List<KirAlkalmazott> kirPedagogusAdatModelList = KirImportHelper.GetKirFelhasznaloList<KirAlkalmazott>(searchModel, KirPedagugisListCacheKey);
|
||||
|
||||
var helper = new AlkalmazottHelper(ConnectionTypeExtensions.GetSessionConnectionType())
|
||||
{
|
||||
GridParameters = Converter.GridParameter(request)
|
||||
};
|
||||
|
||||
var kretaAlkalmazottList = helper.SearchAlkalmazottForKir(searchModel);
|
||||
|
||||
return KirImportLogic.MergeKretaKirFelhasznalo(kretaAlkalmazottList, kirPedagogusAdatModelList, searchModel.StatuszSearch)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetAlkalmazottAlapadatokGrid(int felhasznaloId)
|
||||
{
|
||||
var helper = new AlkalmazottHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var kirAlkalmazott = helper.GetAlkalmazottAlapadatok(felhasznaloId);
|
||||
|
||||
KirAlkalmazottAlapadatok kirAlkalmazottFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirAlkalmazott, KirAlkalmazottAlapadatok>((y) => y), KirPedagugisListCacheKey, kirAlkalmazott.SzuletesiNev, kirAlkalmazott.AnyjaNeve, kirAlkalmazott.SzuletesiDatum.Value, kirAlkalmazott.SzuletesiHely);
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirAlkalmazott, kirAlkalmazottFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetAlkalmazottElerhetosegAdatokGrid(int felhasznaloId)
|
||||
{
|
||||
var helper = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var kirAlkalmazott = helper.GetFelhasznaloElerhetoseg(felhasznaloId, isTanulo: false);
|
||||
|
||||
KirFelhasznaloElerhetosegek kirAlkalmazottFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirAlkalmazott, KirFelhasznaloElerhetosegek>((y) => y), KirPedagugisListCacheKey, kirAlkalmazott.SzuletesiNev, kirAlkalmazott.AnyjaNeve, kirAlkalmazott.SzuletesiDatum.Value, kirAlkalmazott.SzuletesiHely);
|
||||
|
||||
kirAlkalmazott.SzuletesiDatum = null;
|
||||
kirAlkalmazott.SzuletesiHely = null;
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirAlkalmazott, kirAlkalmazottFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetAlkalmazottElsodlegesMunkaugyiAdatokGrid(int felhasznaloId)
|
||||
{
|
||||
var helper = new AlkalmazottHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var kirAlkalmazott = helper.GetAlkalmazottElsodlegesMunkaugyiAdatok(felhasznaloId);
|
||||
|
||||
KirAlkalmazottMunkaugyiAdatok kirAlkalmazottFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirAlkalmazott, KirAlkalmazottMunkaugyiAdatok>((y) => y), KirPedagugisListCacheKey, kirAlkalmazott.SzuletesiNev, kirAlkalmazott.AnyjaNeve, kirAlkalmazott.SzuletesiDatum.Value, kirAlkalmazott.SzuletesiHely);
|
||||
|
||||
kirAlkalmazott.SzuletesiDatum = null;
|
||||
kirAlkalmazott.SzuletesiHely = null;
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirAlkalmazott, kirAlkalmazottFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage ModifyAlkalmazott(KirSzinkronSaveModel postData)
|
||||
{
|
||||
int felhasznaloId = 0;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(postData.FelhasznaloId))
|
||||
{
|
||||
int.TryParse(postData.FelhasznaloId, out felhasznaloId);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (felhasznaloId != 0)
|
||||
{
|
||||
new KirImportLogic().UpdateAlkalmazott(postData, felhasznaloId);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ErrorResource.NemSikerultASzinkronizalas);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage ModifySelected(List<SaveModel> azonositoList)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<KirAlkalmazott> kirPedagogusAdatModelList = KirImportHelper.GetKirFelhasznaloList<KirAlkalmazott>(KirPedagugisListCacheKey);
|
||||
var kirImportLogic = new KirImportLogic();
|
||||
|
||||
foreach (var azonosito in azonositoList)
|
||||
{
|
||||
if (int.TryParse(azonosito.FelhasznaloId, out int felhasznaloId))
|
||||
{
|
||||
KirAlkalmazott kirAlkalmazott = kirPedagogusAdatModelList.Where(x => x.OktatasiAzonosito.Equals(azonosito.OktatasiAzonosito)).FirstOrDefault();
|
||||
|
||||
if (kirAlkalmazott != null)
|
||||
{
|
||||
kirImportLogic.UpdateAlkalmazott(kirAlkalmazott, felhasznaloId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kirImportLogic.InsertAlkalmazott(kirPedagogusAdatModelList.Where(x => x.OktatasiAzonosito.Equals(azonosito.OktatasiAzonosito)).First());
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Caching;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.KIR.Domain.Model;
|
||||
using Kreta.Core.KIR.Factory.Interface;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.KirImportExport.Models.KirImport;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class KirAuthenticationApiController : ApiController
|
||||
{
|
||||
private const int KirLoginCacheExpirationInMinutes = 5;
|
||||
|
||||
private IAuthenticationServiceFactory AuthenticationServiceFactory { get; }
|
||||
private string KirAuthHeaderModelCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirLogin";
|
||||
private string KirTokenCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirToken";
|
||||
|
||||
public KirAuthenticationApiController(IAuthenticationServiceFactory authenticationServiceFactory)
|
||||
{
|
||||
AuthenticationServiceFactory = authenticationServiceFactory ?? throw new ArgumentNullException(nameof(authenticationServiceFactory));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage Login(KirLoginModel kirLoginModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
AuthHeaderModel authHeaderModel = new KirAuthenticationHelper(AuthenticationServiceFactory).Authenticate(kirLoginModel);
|
||||
|
||||
if (!(Cache.Get(KirAuthHeaderModelCacheKey) is AuthHeaderModel))
|
||||
{
|
||||
Cache.Add(KirAuthHeaderModelCacheKey, authHeaderModel, new CacheItemPolicy { SlidingExpiration = TimeSpan.FromMinutes(KirLoginCacheExpirationInMinutes) });
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Cache.Get(KirTokenCacheKey) as string))
|
||||
{
|
||||
Cache.Add(KirTokenCacheKey, authHeaderModel.KirToken, new CacheItemPolicy { AbsoluteExpiration = new DateTimeOffset(DateTime.Now.AddMinutes(KirLoginCacheExpirationInMinutes)) });
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ErrorResource.NemSikerultABejelentkezesHibasFelhasznalonevVagyJelszo);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage KirLoginCheck()
|
||||
{
|
||||
return Cache.Get(KirAuthHeaderModelCacheKey) is AuthHeaderModel ? new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.Core.Domain;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Core.KIR.Factory.Interface;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.KirImportExport.Logic;
|
||||
using Kreta.Web.Areas.KirImportExport.Models;
|
||||
using Kreta.Web.Areas.KirImportExport.Models.KirImport;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.ApiControllers
|
||||
{
|
||||
public class KirTanuloImportApiController : BaseApiController
|
||||
{
|
||||
public KirTanuloImportApiController(IKirServiceFactory kirServiceFactory, IKir2ServiceFactory kir2ServiceFactory) : base(kirServiceFactory, kir2ServiceFactory)
|
||||
{ }
|
||||
|
||||
public DataSourceResult GetKirTanulokGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
|
||||
{
|
||||
var searchModel = JsonConvert.DeserializeObject<KirSearchModel>(data);
|
||||
KirSearchModel.ValidateModel(searchModel);
|
||||
new KirImportLogic().SetKirKretaKod(KirImportHelper, searchModel.KirTelephelyId.Value, KirKretaKodCacheKey);
|
||||
|
||||
List<KirTanulo> kretaTanuloAdatModelList = KirImportHelper.GetKirFelhasznaloList<KirTanulo>(searchModel, KirTanuloListCacheKey);
|
||||
|
||||
var helper = new TanuloHelper(ConnectionTypeExtensions.GetSessionConnectionType())
|
||||
{
|
||||
GridParameters = Converter.GridParameter(request)
|
||||
};
|
||||
|
||||
List<KirTanulo> kirTanuloList = helper.SearchTanuloForKir(searchModel, 0);
|
||||
|
||||
return KirImportLogic.MergeKretaKirFelhasznalo(kirTanuloList, kretaTanuloAdatModelList)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetTanuloAlapadatokGrid(int felhasznaloId)
|
||||
{
|
||||
KirTanuloAlapadatok kirTanulo = new TanuloHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetTanuloAlapadatok(felhasznaloId);
|
||||
|
||||
KirTanuloAlapadatok kirTanuloFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirTanulo, KirTanuloAlapadatok>((y) => y), KirTanuloListCacheKey, kirTanulo.SzuletesiNev, kirTanulo.AnyjaNeve, kirTanulo.SzuletesiDatum.Value, kirTanulo.SzuletesiHely);
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirTanulo, kirTanuloFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetTanuloElerhetosegAdatokGrid(int felhasznaloId)
|
||||
{
|
||||
var helper = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var kirTanulo = helper.GetFelhasznaloElerhetoseg(felhasznaloId, true);
|
||||
|
||||
KirFelhasznaloElerhetosegek kirTanuloFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirTanulo, KirFelhasznaloElerhetosegek>((y) => y), KirTanuloListCacheKey, kirTanulo.SzuletesiNev, kirTanulo.AnyjaNeve, kirTanulo.SzuletesiDatum.Value, kirTanulo.SzuletesiHely);
|
||||
|
||||
kirTanulo.SzuletesiDatum = null;
|
||||
kirTanulo.SzuletesiHely = null;
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirTanulo, kirTanuloFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
public DataSourceResult GetTanuloJogviszonyAdatokGrid(int felhasznaloId)
|
||||
{
|
||||
var kirTanuloJogviszony = new KirTanuloJogviszonyAdatok();
|
||||
var kirSearchModel = new KirSearchModel();
|
||||
|
||||
var helper = new TanuloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var kirTanulo = helper.SearchTanuloForKir(kirSearchModel, felhasznaloId)[0];
|
||||
|
||||
KirTanuloJogviszonyAdatok kirTanuloFromKir = KirImportHelper
|
||||
.GetKirFelhasznaloAdatok(new Converter<KirTanulo, KirTanuloJogviszonyAdatok>((y) => y), KirTanuloListCacheKey, kirTanulo.SzuletesiNev, kirTanulo.AnyjaNeve, kirTanulo.SzuletesiDatum.Value, kirTanulo.SzuletesiHely);
|
||||
|
||||
kirTanulo.SzuletesiDatum = null;
|
||||
kirTanulo.SzuletesiHely = null;
|
||||
|
||||
return KirImportLogic.KirModelEqual(kirTanulo, kirTanuloFromKir)
|
||||
.ToDataSourceResult();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage ModifyTanulo(KirSzinkronSaveModel postData)
|
||||
{
|
||||
int felhasznaloId = 0;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(postData.FelhasznaloId))
|
||||
{
|
||||
int.TryParse(postData.FelhasznaloId, out felhasznaloId);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (felhasznaloId != 0)
|
||||
{
|
||||
new KirImportLogic().UpdateTanulo(postData, felhasznaloId);
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ErrorResource.NemSikerultAMuvelet);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiValidateAjaxAntiForgeryToken]
|
||||
public HttpResponseMessage ModifySelected(List<SaveModel> azonositoList)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<KirTanulo> kirTanuloAdatModelList = KirImportHelper.GetKirFelhasznaloList<KirTanulo>(KirTanuloListCacheKey);
|
||||
var kirImportLogic = new KirImportLogic();
|
||||
|
||||
foreach (var azonosito in azonositoList)
|
||||
{
|
||||
if (int.TryParse(azonosito.FelhasznaloId, out int felhasznaloId))
|
||||
{
|
||||
KirTanulo kirTanulo = kirTanuloAdatModelList.Where(x => x.OktatasiAzonosito.Equals(azonosito.OktatasiAzonosito)).FirstOrDefault();
|
||||
|
||||
if (kirTanulo != null)
|
||||
{
|
||||
kirImportLogic.UpdateTanulo(kirTanulo, felhasznaloId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kirImportLogic.InsertTanulo(kirTanuloAdatModelList.Where(x => x.OktatasiAzonosito.Equals(azonosito.OktatasiAzonosito)).First());
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (BlException e)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue