WIP
This commit is contained in:
@ -52,10 +52,13 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
throw new NotImplementedException("No Activity code");
|
||||
}
|
||||
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 );
|
||||
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == id);
|
||||
var result = _context.Performers
|
||||
.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);
|
||||
}
|
||||
|
||||
|
@ -491,8 +491,11 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
var user = GetCurrentUserAsync().Result;
|
||||
var uid = user.Id;
|
||||
var existing = _dbContext.Performers.Include(x => x.OrganizationAddress)
|
||||
.Include(p=>p.Activity).FirstOrDefault(x => x.PerformerId == uid);
|
||||
var existing = _dbContext.Performers
|
||||
.Include(p=>p.Performer)
|
||||
.Include(x => x.OrganizationAddress)
|
||||
.Include(p=>p.Activity)
|
||||
.FirstOrDefault(x => x.PerformerId == uid);
|
||||
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
if (existing!=null)
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Data.Entity.Infrastructure;
|
||||
using Microsoft.Data.Entity.Metadata;
|
||||
using Microsoft.Data.Entity.Migrations;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace Yavsc.Migrations
|
||||
|
40
Yavsc/Models/IT/Modeling/Code.cs
Normal file
40
Yavsc/Models/IT/Modeling/Code.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using YavscLib;
|
||||
|
||||
namespace Yavsc.Models.IT.Modeling
|
||||
{
|
||||
public abstract class Code<TLetter> : ICode<TLetter> where TLetter : ILetter<TLetter>
|
||||
{
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// !a Count^3 task len
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Validate()
|
||||
{
|
||||
foreach (var letter in this) {
|
||||
var word = this.CreateWord(letter);
|
||||
foreach (var other in this) {
|
||||
IWord<TLetter> first = word.Aggregate(other);
|
||||
foreach (var tierce in this)
|
||||
{
|
||||
var otherword = word.Aggregate(tierce);
|
||||
if (first.Equals(otherword))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract IEnumerator<TLetter> GetEnumerator();
|
||||
|
||||
public abstract IWord<TLetter> CreateWord(TLetter letter);
|
||||
}
|
||||
}
|
16
Yavsc/Models/IT/Modeling/Letter.cs
Normal file
16
Yavsc/Models/IT/Modeling/Letter.cs
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
using YavscLib;
|
||||
|
||||
namespace Yavsc.Models.IT.Modeling
|
||||
{
|
||||
public abstract class Letter<T> : ILetter<T>
|
||||
{
|
||||
public abstract bool Equals(T x, T y);
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return obj.GetHashCode();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace Yavsc.Models.Workflow
|
||||
|
||||
[Key]
|
||||
public string PerformerId { get; set; }
|
||||
[ForeignKey("PerformerId"),Display(Name="Performer")]
|
||||
[ForeignKey("PerformerId")]
|
||||
public virtual ApplicationUser Performer { get; set; }
|
||||
|
||||
[InverseProperty("User")]
|
||||
|
@ -1,5 +1,5 @@
|
||||
@model IEnumerable<PerformerProfile>
|
||||
|
||||
@model IEnumerable<PerformerProfile>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Book - " + (ViewBag.Activity?.Name ?? SR["Any"]);
|
||||
}
|
||||
@ -7,10 +7,11 @@
|
||||
|
||||
@foreach (var profile in Model) {
|
||||
<hr/>
|
||||
@Html.DisplayFor(m=>m)
|
||||
@Html.DisplayFor(m=>m)
|
||||
<form action="~/Command/Create" >
|
||||
<input type="hidden" name="id" value="@profile.PerformerId" />
|
||||
<input type="hidden" name="activityCode" value="@ViewBag.Activity.Code" />
|
||||
<input type="submit" value="@SR["Book "+ViewBag.Activity.Code]"/>
|
||||
</form>
|
||||
</form>
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
@model ApplicationUser
|
||||
|
||||
<img src="~/Avatars/@(Model.UserName).xs.png" alt="avatar">
|
||||
@Model.UserName
|
||||
<ul>
|
||||
@ -18,5 +19,4 @@ asp-route-id="@Model.UserName">@SR["His blog"]</a>
|
||||
<li> @SR["Uses the mobile application, and receives push notifications"]
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
@ -1,7 +1,6 @@
|
||||
@model PerformerProfile
|
||||
|
||||
<div class="performer @(Model.Active?"active":"inactive")">
|
||||
|
||||
@Html.DisplayFor(m=>m.Performer)
|
||||
|
||||
<ul>
|
||||
|
@ -1,42 +0,0 @@
|
||||
@model PerformerProfile
|
||||
|
||||
<div class="performer @(Model.Active?"active":"inactive")">
|
||||
@if (Model.Performer != null) {
|
||||
@if (Model.Performer.Avatar != null) {
|
||||
<img src="~/Avatars/@Model.Performer.Avatar" alt="avatar">
|
||||
}
|
||||
@Model.Performer.UserName
|
||||
|
||||
<ul>
|
||||
|
||||
<li> @SR["Rating"]: @Model.Rate % </li>
|
||||
@if (Model.MinDailyCost != null) {
|
||||
<li>@SR["MinDailyCost"]: @Model.MinDailyCost€</li>
|
||||
}
|
||||
@if (Model.MinDailyCost != null) {
|
||||
<li>@SR["MaxDailyCost"]: @Model.MaxDailyCost€</li>
|
||||
}
|
||||
@if (Model.WebSite!=null) {
|
||||
<li>@SR["WebSite"]: @Model.WebSite</li>
|
||||
}
|
||||
@if (Model.DoesBlog) {
|
||||
<li> <a asp-controller="Blogspot" asp-action="UserPosts"
|
||||
asp-route-id="@Model.Performer.UserName">@SR["His blog"]</a>
|
||||
</li>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(
|
||||
Model.Performer.DedicatedGoogleCalendar))
|
||||
{
|
||||
<li> @SR["Exposes his Google calendar!"]
|
||||
</li>
|
||||
}
|
||||
@if (Model.Performer.Devices?.Count>0)
|
||||
{
|
||||
<li> @SR["Uses the mobile application, and receives push notifications"]
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
|
||||
}
|
||||
</div>
|
22
YavscLib/ICode.cs
Normal file
22
YavscLib/ICode.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YavscLib
|
||||
{
|
||||
public interface ILetter<T> : IEqualityComparer<T> {
|
||||
}
|
||||
public interface IWord<TLetter> where TLetter : ILetter<TLetter>
|
||||
{
|
||||
IWord<TLetter> Aggregate(TLetter other);
|
||||
}
|
||||
|
||||
public interface ICode<TLetter> : IEnumerable<TLetter> where TLetter : ILetter<TLetter>
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks that (b!=c) => a.b != a.c
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool Validate();
|
||||
|
||||
IWord<TLetter> CreateWord(TLetter letter);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user