45 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Web.Http;
 | |
| using System.Web.Http.ModelBinding;
 | |
| using Kendo.Mvc.UI;
 | |
| using Kreta.BusinessLogic.HelperClasses;
 | |
| using Kreta.BusinessLogic.Helpers;
 | |
| using Kreta.BusinessLogic.Security;
 | |
| using Kreta.Web.Areas.Tanar.Models;
 | |
| using Kreta.Web.Helpers;
 | |
| using Kreta.Web.Helpers.Grid;
 | |
| using Kreta.Web.Security;
 | |
| using Newtonsoft.Json;
 | |
| 
 | |
| namespace Kreta.Web.Areas.Tanar.ApiControllers
 | |
| {
 | |
|     [ApiRoleClaimsAuthorize(true)]
 | |
|     [ApiRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
 | |
|     public class HelyettesitendoTanarOraiApiController : ApiController
 | |
|     {
 | |
|         [ApiRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
 | |
|         public DataSourceResult GetHelyettesitesGrid(string data, [ModelBinder(typeof(ModelBinder.DataSourceRequestModelBinder))] DataSourceRequest request)
 | |
|         {
 | |
|             TanarHelyettesitesekKereseseSearchModel model = JsonConvert.DeserializeObject<TanarHelyettesitesekKereseseSearchModel>(data);
 | |
|             TanarHelyettesitesekKereseseCO co = ConvertModelToCo(model);
 | |
| 
 | |
|             var helper = new HelyettesitesHelper(ConnectionTypeExtensions.GetSessionConnectionType());
 | |
|             helper.GridParameters = Converter.GridParameter(request);
 | |
|             var tanarorai = helper.GetHelyettesitettTanorak(co);
 | |
|             return tanarorai.ToDataSourceResult();
 | |
|         }
 | |
| 
 | |
|         private TanarHelyettesitesekKereseseCO ConvertModelToCo(TanarHelyettesitesekKereseseSearchModel model)
 | |
|         {
 | |
|             TanarHelyettesitesekKereseseCO co = new TanarHelyettesitesekKereseseCO()
 | |
|             {
 | |
|                 HelyettesitesKezdete = model.IdoszakKezdete,
 | |
|                 HelyettesitesVege = model.IdoszakVege,
 | |
|                 HelyettesitettId = model.HelyettesitettId,
 | |
|                 HelyettesitoId = model.HelyettesitoId
 | |
|             };
 | |
| 
 | |
|             return co;
 | |
|         }
 | |
|     }
 | |
| }
 |