using System.Net; using System.Net.Http; using System.Web.Http; using Kreta.BusinessLogic.Helpers; using Kreta.BusinessLogic.Security; using Kreta.Web.Areas.Kerdoiv.Models; using Kreta.Web.Helpers; using Kreta.Web.Security; namespace Kreta.Web.Areas.Kerdoiv.ApiControllers { [ApiRoleClaimsAuthorize(true)] [ApiRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue, KretaClaimPackages.Osztalyfonok.ClaimValue, KretaClaimPackages.SzuperOsztalyfonok.ClaimValue)] public class NatKerdoivApiController : ApiController { [HttpPost] [ApiValidateAjaxAntiForgeryToken] public HttpResponseMessage Save(NatKerdoivModel model) { ModelState.Merge(model.Validate()); if (ModelState.IsValid) { var helper = new KerdoivHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()); helper.Save(model.ToCo()); return new HttpResponseMessage(HttpStatusCode.OK); } return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } [HttpPost] [ApiValidateAjaxAntiForgeryToken] public HttpResponseMessage SetNatKerdoivIsLattamTrue() { var helper = new KerdoivHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()); helper.SetNatKerdoivIsLattamTrue(); return new HttpResponseMessage(HttpStatusCode.OK); } } }