From 0e7dd6628dbd34e9ddf52079538c1179aed87dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 3 Nov 2017 10:31:37 +0300 Subject: [PATCH] Made Ticket index razor page. --- .../Controllers/TicketsController.cs | 31 ------------------- .../Models/Tickets/IndexViewModel.cs | 10 ------ .../{Views => Pages}/Tickets/Index.cshtml | 4 +-- .../Pages/Tickets/Index.cshtml.cs | 26 ++++++++++++++++ 4 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 src/AbpDesk/AbpDesk.Web.Mvc/Controllers/TicketsController.cs delete mode 100644 src/AbpDesk/AbpDesk.Web.Mvc/Models/Tickets/IndexViewModel.cs rename src/AbpDesk/AbpDesk.Web.Mvc/{Views => Pages}/Tickets/Index.cshtml (82%) create mode 100644 src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml.cs diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Controllers/TicketsController.cs b/src/AbpDesk/AbpDesk.Web.Mvc/Controllers/TicketsController.cs deleted file mode 100644 index fde586ecd7..0000000000 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Controllers/TicketsController.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Threading.Tasks; -using AbpDesk.Tickets; -using AbpDesk.Tickets.Dtos; -using AbpDesk.Web.Mvc.Models.Tickets; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; - -namespace AbpDesk.Web.Mvc.Controllers -{ - public class TicketsController : AbpController - { - private readonly ITicketAppService _ticketAppService; - - public TicketsController(ITicketAppService ticketAppService) - { - _ticketAppService = ticketAppService; - } - - public async Task Index(GetAllTicketsInput input) - { - var result = await _ticketAppService.GetAll(input); - - var model = new IndexViewModel - { - Tickets = result.Items - }; - - return View(model); - } - } -} diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Models/Tickets/IndexViewModel.cs b/src/AbpDesk/AbpDesk.Web.Mvc/Models/Tickets/IndexViewModel.cs deleted file mode 100644 index 24229b7d9c..0000000000 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Models/Tickets/IndexViewModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using AbpDesk.Tickets.Dtos; - -namespace AbpDesk.Web.Mvc.Models.Tickets -{ - public class IndexViewModel - { - public IReadOnlyList Tickets { get; set; } - } -} diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Views/Tickets/Index.cshtml b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml similarity index 82% rename from src/AbpDesk/AbpDesk.Web.Mvc/Views/Tickets/Index.cshtml rename to src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml index e7ff73ee02..b3622ddd2d 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Views/Tickets/Index.cshtml +++ b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml @@ -1,5 +1,5 @@ -@using AbpDesk.Web.Mvc.Models.Tickets -@model IndexViewModel +@page +@model AbpDesk.Web.Mvc.Pages.Tickets.IndexModel @section styles { diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml.cs b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml.cs new file mode 100644 index 0000000000..ea36049149 --- /dev/null +++ b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/Tickets/Index.cshtml.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using AbpDesk.Tickets; +using AbpDesk.Tickets.Dtos; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace AbpDesk.Web.Mvc.Pages.Tickets +{ + public class IndexModel : PageModel + { + public IReadOnlyList Tickets { get; set; } + + private readonly ITicketAppService _ticketAppService; + + public IndexModel(ITicketAppService ticketAppService) + { + _ticketAppService = ticketAppService; + } + + public async Task OnGetAsync(GetAllTicketsInput input) + { + var result = await _ticketAppService.GetAll(input); + Tickets = result.Items; + } + } +}