소스 검색

перенесены данные для форм в отдельный контролер

WoI 6 달 전
부모
커밋
6ad19e1ea3
2개의 변경된 파일65개의 추가작업 그리고 47개의 파일을 삭제
  1. 1 47
      OnlineMetodist.API/Controllers/EventsController.cs
  2. 64 0
      OnlineMetodist.API/Controllers/ValuesFormsController.cs

+ 1 - 47
OnlineMetodist.API/Controllers/EventsController.cs

@@ -29,53 +29,7 @@ namespace OnlineMetodist.API.Controllers
 			_userManager = userManager;
 		}
 
-		[HttpGet]
-		//[Route("GetParticipationForms")]
-		public async Task<ActionResult<List<string>>> GetParticipationForms()
-		{
-			if(EnumsEvent.ParticipationForms.Any())
-			{
-				return Ok(EnumsEvent.ParticipationForms);
-			}
-			_logger.LogError($"Participation forms is empty");
-			return NotFound("Participation forms object sent from client is null.");
-		}
-
-		[HttpGet]
-		//[Route("GetEventForms")]
-		public async Task<ActionResult<List<string>>> GetEventForms()
-		{
-			if(EnumsEvent.EventForms.Any())
-			{
-				return Ok(EnumsEvent.EventForms);
-			}
-			_logger.LogError($"Event forms is empty");
-			return NotFound("Event forms object sent from client is null.");
-		}
-
-		[HttpGet]
-		//[Route("GetStatusEvents")]
-		public async Task<ActionResult<List<string>>> GetStatusEvents()
-		{
-			if(EnumsEvent.StatusEvents.Any())
-			{
-				return Ok(EnumsEvent.StatusEvents);
-			}
-			_logger.LogError($"Status events is empty");
-			return NotFound("Status events sent from client is null.");
-		}
-
-		[HttpGet]
-		//[Route("GetResultEvents")]
-		public async Task<ActionResult<List<string>>> GetResultEvents()
-		{
-			if(EnumsEvent.ResultEvents.Any())
-			{
-				return Ok(EnumsEvent.ResultEvents);
-			}
-			_logger.LogError($"Result events is empty");
-			return NotFound("Result events sent from client is null.");
-		}
+		
 
 		[HttpGet]
 		//[Route("GetEvents")]

+ 64 - 0
OnlineMetodist.API/Controllers/ValuesFormsController.cs

@@ -0,0 +1,64 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using OnlineMetodist.API.Enums;
+
+namespace OnlineMetodist.API.Controllers
+{
+	[Authorize]
+	[Route("api/[controller]/[action]")]
+	[ApiController]
+	public class ValuesFormsController : ControllerBase
+	{
+		private readonly ILogger<ValuesFormsController> _logger;
+
+		public ValuesFormsController(ILogger<ValuesFormsController> logger)
+		{
+			_logger = logger;
+		}
+
+		[HttpGet]
+		public async Task<ActionResult<List<string>>> GetParticipationForms()
+		{
+			if (EnumsEvent.ParticipationForms.Any())
+			{
+				return Ok(EnumsEvent.ParticipationForms);
+			}
+			_logger.LogError($"Participation forms is empty");
+			return NotFound("Participation forms object sent from client is null.");
+		}
+
+		[HttpGet]
+		public async Task<ActionResult<List<string>>> GetEventForms()
+		{
+			if (EnumsEvent.EventForms.Any())
+			{
+				return Ok(EnumsEvent.EventForms);
+			}
+			_logger.LogError($"Event forms is empty");
+			return NotFound("Event forms object sent from client is null.");
+		}
+
+		[HttpGet]
+		public async Task<ActionResult<List<string>>> GetStatusEvents()
+		{
+			if (EnumsEvent.StatusEvents.Any())
+			{
+				return Ok(EnumsEvent.StatusEvents);
+			}
+			_logger.LogError($"Status events is empty");
+			return NotFound("Status events sent from client is null.");
+		}
+
+		[HttpGet]
+		public async Task<ActionResult<List<string>>> GetResultEvents()
+		{
+			if (EnumsEvent.ResultEvents.Any())
+			{
+				return Ok(EnumsEvent.ResultEvents);
+			}
+			_logger.LogError($"Result events is empty");
+			return NotFound("Result events sent from client is null.");
+		}
+	}
+}