From e8a0041c5eef48bf6f422e60deb0410b04bfd604 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 1 Aug 2016 01:43:15 +0200 Subject: [PATCH] refactoring --- Yavsc/Controllers/FrontOfficeController.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Yavsc/Controllers/FrontOfficeController.cs b/Yavsc/Controllers/FrontOfficeController.cs index f68d0415..0b87937d 100644 --- a/Yavsc/Controllers/FrontOfficeController.cs +++ b/Yavsc/Controllers/FrontOfficeController.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using Yavsc.Models.Booking; using Yavsc.Helpers; using Yavsc.Models.Billing; +using System; namespace Yavsc.Controllers { @@ -39,11 +40,13 @@ namespace Yavsc.Controllers public ActionResult Book(string id) { - if (id != null) { + if (id == null) { + throw new NotImplementedException("No Activity code"); + } + ViewBag.Activities = _context.ActivityItems(id); ViewBag.Activity = _context.Activities.FirstOrDefault( - a => a.Code == id - ); + a => a.Code == id ); return View( _context.Performers.Include(p=>p.Performer).Where @@ -51,14 +54,6 @@ namespace Yavsc.Controllers x=>x.MinDailyCost ) ); - } - ViewBag.Activities = _context.ActivityItems(null); - - return View ( - _context.Performers.Include(p=>p.Performer).Where - (p => p.Active).OrderBy( - x=>x.MinDailyCost - )); } [Route("Book/{id}"),HttpPost]