main
Paul Schneider 9 years ago
parent c59ac14ae9
commit 8a4a778322
1 changed files with 23 additions and 27 deletions

@ -1,18 +1,18 @@
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Yavsc.Models;
using System.Linq;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Yavsc.Models.Booking;
using Yavsc.Helpers;
using System; using System;
using Yavsc.ViewModels.FrontOffice; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
using Helpers;
using Models;
using Models.Booking;
using ViewModels.FrontOffice;
public class FrontOfficeController : Controller public class FrontOfficeController : Controller
{ {
ApplicationDbContext _context; ApplicationDbContext _context;
@ -32,7 +32,8 @@ namespace Yavsc.Controllers
var uid = User.GetUserId(); var uid = User.GetUserId();
var now = DateTime.Now; var now = DateTime.Now;
var model = new FrontOfficeIndexViewModel{ var model = new FrontOfficeIndexViewModel
{
EstimateToProduceCount = _context.Commands.Where(c => c.PerformerId == uid && c.EventDate > now EstimateToProduceCount = _context.Commands.Where(c => c.PerformerId == uid && c.EventDate > now
&& c.ValidationDate == null && !_context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null))).Count(), && c.ValidationDate == null && !_context.Estimates.Any(e => (e.CommandId == c.Id && e.ProviderValidationDate != null))).Count(),
EstimateToSignAsProCount = _context.Commands.Where(c => (c.PerformerId == uid && c.EventDate > now EstimateToSignAsProCount = _context.Commands.Where(c => (c.PerformerId == uid && c.EventDate > now
@ -53,12 +54,7 @@ namespace Yavsc.Controllers
throw new NotImplementedException("No Activity code"); throw new NotImplementedException("No Activity code");
} }
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == id); ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == id);
var result = _context.Performers var result = _context.ListPerformers(id);
.Include(p=>p.Activity)
.Include(p=>p.Performer)
.Include(p=>p.Performer.Posts)
.Include(p=>p.Performer.Devices)
.Where(p => p.Active && p.Activity.Any(u=>u.DoesCode==id)).OrderBy( x => x.Rate ).ToList();
return View(result); return View(result);
} }

Loading…