From 6c7b4c70439a29dfe9c2671999db2c2ae5f64a48 Mon Sep 17 00:00:00 2001 From: Charles Levesque Date: Mon, 11 Jul 2016 21:09:15 -0400 Subject: [PATCH] feat Added beginning of the Sell view Not much more than boilerplate code. Github issue #18 --- LivrETS/Controllers/FairController.cs | 31 +++++++++----- LivrETS/LivrETS.csproj | 1 + LivrETS/ViewModels/FairViewModels.cs | 5 +++ LivrETS/Views/Fair/Pick.cshtml | 2 +- LivrETS/Views/Fair/Sell.cshtml | 62 +++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 LivrETS/Views/Fair/Sell.cshtml diff --git a/LivrETS/Controllers/FairController.cs b/LivrETS/Controllers/FairController.cs index b7bbb86..7829e61 100644 --- a/LivrETS/Controllers/FairController.cs +++ b/LivrETS/Controllers/FairController.cs @@ -58,9 +58,9 @@ public ActionResult Pick() var currentFair = Repository.GetCurrentFair(); var currentStep = 0; - model.Fair = currentFair; - model.CurrentStep = currentStep; - model.NumberOfPhases = NUMBER_OF_STEPS; + model.Fair = currentFair; + model.CurrentStep = currentStep; + model.NumberOfPhases = NUMBER_OF_STEPS; Session[CURRENT_STEP] = currentStep; return View(model); } @@ -93,11 +93,11 @@ public ActionResult Pick(FairViewModel model) if (seller == null) return RedirectToAction(nameof(Pick)); Session[CURRENT_STEP] = 1; - Session[SELLER] = seller.Id; - model.CurrentStep = 1; - model.User = seller; - model.UserOffers = seller.Offers; - model.FairOffers = currentFair.Offers; + Session[SELLER] = seller.Id; + model.CurrentStep = 1; + model.User = seller; + model.UserOffers = seller.Offers; + model.FairOffers = currentFair.Offers; break; case 1: @@ -110,8 +110,8 @@ public ActionResult Pick(FairViewModel model) .ConvertAll(new Converter(offer => offer.Id.ToString())); Session[CURRENT_STEP] = 2; - model.CurrentStep = 2; - model.User = seller1; + model.CurrentStep = 2; + model.User = seller1; break; case 2: @@ -119,7 +119,16 @@ public ActionResult Pick(FairViewModel model) } } - + return View(model); + } + + [HttpGet] + public ActionResult Sell() + { + SellViewModel model = new SellViewModel() + { + Fair = Repository.GetCurrentFair() + }; return View(model); } diff --git a/LivrETS/LivrETS.csproj b/LivrETS/LivrETS.csproj index cd9cb7d..5021c1c 100644 --- a/LivrETS/LivrETS.csproj +++ b/LivrETS/LivrETS.csproj @@ -288,6 +288,7 @@ + diff --git a/LivrETS/ViewModels/FairViewModels.cs b/LivrETS/ViewModels/FairViewModels.cs index dd1c854..d9c42b7 100644 --- a/LivrETS/ViewModels/FairViewModels.cs +++ b/LivrETS/ViewModels/FairViewModels.cs @@ -34,4 +34,9 @@ public class FairViewModel public ICollection FairOffers { get; set; } public string UserBarCode { get; set; } } + + public class SellViewModel + { + public Fair Fair; + } } \ No newline at end of file diff --git a/LivrETS/Views/Fair/Pick.cshtml b/LivrETS/Views/Fair/Pick.cshtml index a7128b2..3764429 100644 --- a/LivrETS/Views/Fair/Pick.cshtml +++ b/LivrETS/Views/Fair/Pick.cshtml @@ -27,7 +27,7 @@ @if (Model.Fair == null || Model.Fair.Phase != FairPhase.PICKING) { -

Vous n'êtes présentement pas en phase de cueillette =(

+

Vous n'êtes pas présentement en période de cueillette =(

} else { diff --git a/LivrETS/Views/Fair/Sell.cshtml b/LivrETS/Views/Fair/Sell.cshtml new file mode 100644 index 0000000..253e7e6 --- /dev/null +++ b/LivrETS/Views/Fair/Sell.cshtml @@ -0,0 +1,62 @@ +@* + LivrETS - Centralized system that manages selling of pre-owned ETS goods. + Copyright (C) 2016 TribuTerre + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see +*@ +@using LivrETS.ViewModels +@using LivrETS.Models +@model FairViewModel +@{ + ViewBag.Title = "Terminal de vente"; +} + +@if (Model.Fair == null || Model.Fair.Phase != FairPhase.SALE) +{ +

Vous n'êtes pas présentement en période de vente =(

+} +else +{ + + +
+
+ +
+
+ +
+
+

Articles

+
+
+ +
+
+ + + + + + + + + + +
IDTitreVendeurPrix
+
+
+}