refactoring
This commit is contained in:
parent
3043646ee8
commit
1e6c1d15db
57 changed files with 3368 additions and 248 deletions
|
|
@ -22,16 +22,16 @@ namespace Yavsc.Controllers
|
|||
[ServiceFilter(typeof(LanguageActionFilter))]
|
||||
public class CommandController : Controller
|
||||
{
|
||||
private UserManager<ApplicationUser> _userManager;
|
||||
private ApplicationDbContext _context;
|
||||
private GoogleAuthSettings _googleSettings;
|
||||
private IGoogleCloudMessageSender _GCMSender;
|
||||
private IEmailSender _emailSender;
|
||||
private IStringLocalizer _localizer;
|
||||
SiteSettings _siteSettings;
|
||||
SmtpSettings _smtpSettings;
|
||||
protected UserManager<ApplicationUser> _userManager;
|
||||
protected ApplicationDbContext _context;
|
||||
protected GoogleAuthSettings _googleSettings;
|
||||
protected IGoogleCloudMessageSender _GCMSender;
|
||||
protected IEmailSender _emailSender;
|
||||
protected IStringLocalizer _localizer;
|
||||
protected SiteSettings _siteSettings;
|
||||
protected SmtpSettings _smtpSettings;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
protected readonly ILogger _logger;
|
||||
public CommandController(ApplicationDbContext context, IOptions<GoogleAuthSettings> googleSettings,
|
||||
IGoogleCloudMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
|
|
@ -57,7 +57,7 @@ namespace Yavsc.Controllers
|
|||
public IActionResult Index()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
return View(_context.BookQueries
|
||||
return View(_context.RdvQueries
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.PerformerProfile)
|
||||
.Include(x => x.PerformerProfile.Performer)
|
||||
|
|
@ -74,7 +74,7 @@ namespace Yavsc.Controllers
|
|||
return HttpNotFound();
|
||||
}
|
||||
|
||||
BookQuery command = _context.BookQueries
|
||||
RdvQuery command = _context.RdvQueries
|
||||
.Include(x => x.Location)
|
||||
.Include(x => x.PerformerProfile)
|
||||
.Single(m => m.Id == id);
|
||||
|
|
@ -113,7 +113,7 @@ namespace Yavsc.Controllers
|
|||
ViewBag.GoogleSettings = _googleSettings;
|
||||
var userid = User.GetUserId();
|
||||
var user = _userManager.FindByIdAsync(userid).Result;
|
||||
return View(new BookQuery(activityCode,new Location(),DateTime.Now.AddHours(4))
|
||||
return View(new RdvQuery(activityCode,new Location(),DateTime.Now.AddHours(4))
|
||||
{
|
||||
PerformerProfile = pro,
|
||||
PerformerId = pro.PerformerId,
|
||||
|
|
@ -126,7 +126,7 @@ namespace Yavsc.Controllers
|
|||
// POST: Command/Create
|
||||
[HttpPost, Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(BookQuery command)
|
||||
public async Task<IActionResult> Create(RdvQuery command)
|
||||
{
|
||||
|
||||
var uid = User.GetUserId();
|
||||
|
|
@ -161,7 +161,7 @@ namespace Yavsc.Controllers
|
|||
command.Location=existingLocation;
|
||||
}
|
||||
else _context.Attach<Location>(command.Location);
|
||||
_context.BookQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
var yaev = command.CreateEvent(_localizer);
|
||||
|
|
@ -206,7 +206,7 @@ namespace Yavsc.Controllers
|
|||
return HttpNotFound();
|
||||
}
|
||||
|
||||
BookQuery command = _context.BookQueries.Single(m => m.Id == id);
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
if (command == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
|
|
@ -217,7 +217,7 @@ namespace Yavsc.Controllers
|
|||
// POST: Command/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public IActionResult Edit(BookQuery command)
|
||||
public IActionResult Edit(RdvQuery command)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ namespace Yavsc.Controllers
|
|||
return HttpNotFound();
|
||||
}
|
||||
|
||||
BookQuery command = _context.BookQueries.Single(m => m.Id == id);
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
if (command == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
|
|
@ -251,8 +251,8 @@ namespace Yavsc.Controllers
|
|||
[ValidateAntiForgeryToken]
|
||||
public IActionResult DeleteConfirmed(long id)
|
||||
{
|
||||
BookQuery command = _context.BookQueries.Single(m => m.Id == id);
|
||||
_context.BookQueries.Remove(command);
|
||||
RdvQuery command = _context.RdvQueries.Single(m => m.Id == id);
|
||||
_context.RdvQueries.Remove(command);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Yavsc.Controllers
|
|||
public IActionResult Create()
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
IQueryable<BookQuery> queries = _context.BookQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid);
|
||||
IQueryable<RdvQuery> queries = _context.RdvQueries.Include(q=>q.Location).Where(bq=>bq.PerformerId == uid);
|
||||
//.Select(bq=>new SelectListItem{ Text = bq.Client.UserName, Value = bq.Client.Id });
|
||||
ViewBag.Clients = queries.Select(q=>q.Client).Distinct();
|
||||
ViewBag.Queries = queries;
|
||||
|
|
@ -103,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
_context.Estimates
|
||||
.Add(estimate);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
var query = _context.BookQueries.FirstOrDefault(
|
||||
var query = _context.RdvQueries.FirstOrDefault(
|
||||
q=>q.Id == estimate.CommandId
|
||||
);
|
||||
var perfomerProfile = _context.Performers
|
||||
|
|
@ -111,7 +111,7 @@ namespace Yavsc.Controllers
|
|||
perpr => perpr.Performer).FirstOrDefault(
|
||||
x=>x.PerformerId == query.PerformerId
|
||||
);
|
||||
var command = _context.BookQueries.FirstOrDefault(
|
||||
var command = _context.RdvQueries.FirstOrDefault(
|
||||
cmd => cmd.Id == estimate.CommandId
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,13 @@ using System.Security.Claims;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
using Helpers;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Models;
|
||||
using Models.Workflow;
|
||||
using Newtonsoft.Json;
|
||||
using ViewModels.FrontOffice;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.ViewModels.Haircut;
|
||||
|
||||
public class FrontOfficeController : Controller
|
||||
{
|
||||
ApplicationDbContext _context;
|
||||
|
|
@ -46,7 +50,7 @@ namespace Yavsc.Controllers
|
|||
return View(model);
|
||||
}
|
||||
|
||||
[Route("Profiles/{id?}"), HttpGet, AllowAnonymous]
|
||||
[AllowAnonymous]
|
||||
public ActionResult Profiles(string id)
|
||||
{
|
||||
if (id == null)
|
||||
|
|
@ -57,40 +61,28 @@ namespace Yavsc.Controllers
|
|||
var result = _context.ListPerformers(id);
|
||||
return View(result);
|
||||
}
|
||||
|
||||
[Route("Profiles/{id}"), HttpPost, AllowAnonymous]
|
||||
public ActionResult Profiles(BookQuery bookQuery)
|
||||
|
||||
[AllowAnonymous]
|
||||
public ActionResult HairCut(string id)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var pro = _context.Performers.Include(
|
||||
pr => pr.Performer
|
||||
).FirstOrDefault(
|
||||
x => x.PerformerId == bookQuery.PerformerId
|
||||
);
|
||||
if (pro == null)
|
||||
return HttpNotFound();
|
||||
// Let's create a command
|
||||
if (bookQuery.Id == 0)
|
||||
{
|
||||
_context.BookQueries.Add(bookQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.BookQueries.Update(bookQuery);
|
||||
}
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
// TODO Send sys notifications &
|
||||
// notify the user (make him a basket badge)
|
||||
return View("Index");
|
||||
HairPrestation pPrestation=null;
|
||||
var prestaJson = HttpContext.Session.GetString("HairCutPresta") ;
|
||||
if (prestaJson!=null) {
|
||||
pPrestation = JsonConvert.DeserializeObject<HairPrestation>(prestaJson);
|
||||
}
|
||||
ViewBag.Activities = _context.ActivityItems(null);
|
||||
return View("Profiles", _context.Performers.Include(p => p.Performer).Where
|
||||
(p => p.Active).OrderBy(
|
||||
x => x.MinDailyCost
|
||||
));
|
||||
else pPrestation = new HairPrestation {
|
||||
|
||||
};
|
||||
|
||||
ViewBag.Activity = _context.Activities.First(a => a.Code == id);
|
||||
var result = new HairCutView {
|
||||
HairBrushers = _context.ListPerformers(id),
|
||||
Topic = pPrestation
|
||||
} ;
|
||||
return View(result);
|
||||
}
|
||||
|
||||
|
||||
[Produces("text/x-tex"), Authorize, Route("estimate-{id}.tex")]
|
||||
public ViewResult EstimateTex(long id)
|
||||
{
|
||||
|
|
|
|||
189
Yavsc/Controllers/HairCutCommandController.cs
Normal file
189
Yavsc/Controllers/HairCutCommandController.cs
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Google.Messaging;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.Models.Relationship;
|
||||
using Yavsc.Services;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class HairCutCommandController : CommandController
|
||||
{
|
||||
public HairCutCommandController(ApplicationDbContext context,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IGoogleCloudMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
|
||||
IEmailSender emailSender,
|
||||
IOptions<SmtpSettings> smtpSettings,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
ILoggerFactory loggerFactory) : base(context,googleSettings,GCMSender,userManager,
|
||||
localizer,emailSender,smtpSettings,siteSettings,loggerFactory)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpPost, Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> CreateHairCutQuery(HairCutQuery command)
|
||||
{
|
||||
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var prid = command.PerformerId;
|
||||
if (string.IsNullOrWhiteSpace(uid)
|
||||
|| string.IsNullOrWhiteSpace(prid))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs a PerformerId"
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.Devices)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
var user = await _userManager.FindByIdAsync(uid);
|
||||
command.Client = user;
|
||||
command.ClientId = uid;
|
||||
command.PerformerProfile = pro;
|
||||
// FIXME Why!!
|
||||
// ModelState.ClearValidationState("PerformerProfile.Avatar");
|
||||
// ModelState.ClearValidationState("Client.Avatar");
|
||||
// ModelState.ClearValidationState("ClientId");
|
||||
ModelState.MarkFieldSkipped("ClientId");
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
|
||||
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
|
||||
|
||||
if (existingLocation!=null) {
|
||||
command.Location=existingLocation;
|
||||
}
|
||||
else _context.Attach<Location>(command.Location);
|
||||
|
||||
_context.HairCutQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
var yaev = command.CreateEvent(_localizer);
|
||||
MessageWithPayloadResponse grep = null;
|
||||
|
||||
if (pro.AcceptNotifications
|
||||
&& pro.AcceptPublicContact)
|
||||
{
|
||||
if (pro.Performer.Devices.Count > 0) {
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile
|
||||
// if (grep==null || grep.success<=0 || grep.failure>0)
|
||||
ViewBag.GooglePayload=grep;
|
||||
if (grep!=null)
|
||||
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
|
||||
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
command.PerformerProfile.Performer.Email,
|
||||
yaev.Topic+" "+yaev.Sender,
|
||||
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
|
||||
);
|
||||
}
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View("CommandConfirmation",command);
|
||||
}
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View(command);
|
||||
|
||||
}
|
||||
|
||||
[HttpPost, Authorize]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> CreateHairMultiCutQuery(HairMultiCutQuery command)
|
||||
{
|
||||
|
||||
var uid = User.GetUserId();
|
||||
var prid = command.PerformerId;
|
||||
if (string.IsNullOrWhiteSpace(uid)
|
||||
|| string.IsNullOrWhiteSpace(prid))
|
||||
throw new InvalidOperationException(
|
||||
"This method needs a PerformerId"
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.Devices)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
var user = await _userManager.FindByIdAsync(uid);
|
||||
command.Client = user;
|
||||
command.ClientId = uid;
|
||||
command.PerformerProfile = pro;
|
||||
// FIXME Why!!
|
||||
// ModelState.ClearValidationState("PerformerProfile.Avatar");
|
||||
// ModelState.ClearValidationState("Client.Avatar");
|
||||
// ModelState.ClearValidationState("ClientId");
|
||||
ModelState.MarkFieldSkipped("ClientId");
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
|
||||
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
|
||||
|
||||
if (existingLocation!=null) {
|
||||
command.Location=existingLocation;
|
||||
}
|
||||
else _context.Attach<Location>(command.Location);
|
||||
|
||||
_context.HairMultiCutQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
var yaev = command.CreateEvent(_localizer);
|
||||
MessageWithPayloadResponse grep = null;
|
||||
|
||||
if (pro.AcceptNotifications
|
||||
&& pro.AcceptPublicContact)
|
||||
{
|
||||
if (pro.Performer.Devices.Count > 0) {
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(_googleSettings,regids,yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
// both on mailbox and mobile
|
||||
// if (grep==null || grep.success<=0 || grep.failure>0)
|
||||
ViewBag.GooglePayload=grep;
|
||||
if (grep!=null)
|
||||
_logger.LogWarning($"Performer: {command.PerformerProfile.Performer.UserName} success: {grep.success} failure: {grep.failure}");
|
||||
|
||||
await _emailSender.SendEmailAsync(
|
||||
_siteSettings, _smtpSettings,
|
||||
command.PerformerProfile.Performer.Email,
|
||||
yaev.Topic+" "+yaev.Sender,
|
||||
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
|
||||
);
|
||||
}
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View("CommandConfirmation",command);
|
||||
}
|
||||
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
|
||||
ViewBag.GoogleSettings = _googleSettings;
|
||||
return View(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
Yavsc/Controllers/HairPrestationsController.cs
Normal file
122
Yavsc/Controllers/HairPrestationsController.cs
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Haircut;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
public class HairPrestationsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public HairPrestationsController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: HairPrestations
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.HairPrestation.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: HairPrestations/Details/5
|
||||
public async Task<IActionResult> Details(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||
if (hairPrestation == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(hairPrestation);
|
||||
}
|
||||
|
||||
// GET: HairPrestations/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: HairPrestations/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create(HairPrestation hairPrestation)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.HairPrestation.Add(hairPrestation);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(hairPrestation);
|
||||
}
|
||||
|
||||
// GET: HairPrestations/Edit/5
|
||||
public async Task<IActionResult> Edit(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||
if (hairPrestation == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(hairPrestation);
|
||||
}
|
||||
|
||||
// POST: HairPrestations/Edit/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(HairPrestation hairPrestation)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Update(hairPrestation);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(hairPrestation);
|
||||
}
|
||||
|
||||
// GET: HairPrestations/Delete/5
|
||||
[ActionName("Delete")]
|
||||
public async Task<IActionResult> Delete(long? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||
if (hairPrestation == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
return View(hairPrestation);
|
||||
}
|
||||
|
||||
// POST: HairPrestations/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(long id)
|
||||
{
|
||||
HairPrestation hairPrestation = await _context.HairPrestation.SingleAsync(m => m.Id == id);
|
||||
_context.HairPrestation.Remove(hairPrestation);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ namespace Yavsc.Controllers
|
|||
UserName = user.UserName,
|
||||
PostsCounter = pc,
|
||||
Balance = user.AccountBalance,
|
||||
ActiveCommandCount = _dbContext.BookQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.Now)),
|
||||
ActiveCommandCount = _dbContext.RdvQueries.Count(x => (x.ClientId == user.Id) && (x.EventDate > DateTime.Now)),
|
||||
HasDedicatedCalendar = !string.IsNullOrEmpty(user.DedicatedGoogleCalendar),
|
||||
Roles = await _userManager.GetRolesAsync(user),
|
||||
PostalAddress = user.PostalAddress?.Address,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue