Gestion des activités

This commit is contained in:
2017-01-09 16:29:34 +01:00
parent 48c9af0917
commit 6b683eb4af
22 changed files with 91 additions and 63 deletions

View File

@ -161,7 +161,6 @@ namespace Yavsc.Controllers
if (pro.Performer.Devices.Count > 0) {
var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId);
var sregids = string.Join(",",regids);
grep = await _GCMSender.NotifyBookQueryAsync(_googleSettings,regids,yaev);
}
// TODO setup a profile choice to allow notifications

View File

@ -19,8 +19,8 @@ namespace Yavsc.Controllers
_context = context;
}
// GET: Do
[HttpGet,ActionName("Index")]
// GET: /Do/Index
[HttpGet]
public IActionResult Index(string id)
{
if (id == null)

View File

@ -11,8 +11,6 @@ using System;
namespace Yavsc.Controllers
{
[ServiceFilter(typeof(LanguageActionFilter)),
Route("do")]
public class FrontOfficeController : Controller
{
ApplicationDbContext _context;
@ -42,17 +40,11 @@ namespace Yavsc.Controllers
{
throw new NotImplementedException("No Activity code");
}
ViewBag.Activity = _context.Activities.FirstOrDefault(
a => a.Code == id);
return View(
_context.Performers.Include(p => p.Performer)
.Include(p=>p.Performer.Devices).Where
(p => p.Activity.Any( a => a.DoesCode == id) && p.Active).OrderBy(
x => x.MinDailyCost
)
);
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == id);
var result = _context.Performers
.Include(p=>p.Performer).Where(p => p.Activity.Any(u=>u.DoesCode==id)).OrderBy( x => x.MinDailyCost );
return View(result);
}
[Route("Book/{id}"), HttpPost]

View File

@ -110,11 +110,9 @@ namespace Yavsc.Controllers
DiskUsage = user.DiskUsage,
DiskQuota = user.DiskQuota
};
if (_dbContext.Performers.Any(x => x.PerformerId == user.Id))
{
model.Activity = _dbContext.Performers.First(x => x.PerformerId == user.Id).Activity;
}
model.HaveProfessionalSettings = _dbContext.Performers.Any(x => x.PerformerId == user.Id);
model.Activity = _dbContext.UserActivities.Include(a=>a.Does).Where(u=>u.UserId == user.Id)
.ToList();
return View(model);
}
@ -522,6 +520,7 @@ namespace Yavsc.Controllers
{
if (ModelState.IsValid)
{
var exSiren = await _dbContext.ExceptionsSIREN.FirstOrDefaultAsync(
ex => ex.SIREN == model.SIREN
);
@ -574,8 +573,8 @@ namespace Yavsc.Controllers
}
else ModelState.AddModelError(string.Empty, $"Access denied ({uid} vs {model.PerformerId})");
}
ViewBag.GoogleSettings = _googleSettings;
ViewBag.Activities = _dbContext.ActivityItems(model.Activity);
return View(model);
}