For code format

main
Paul Schneider 7 years ago
parent e70b48fed4
commit c14f749866
1 changed files with 44 additions and 40 deletions

@ -65,7 +65,7 @@ namespace Yavsc.Controllers
.Include(x => x.PerformerProfile)
.Include(x => x.PerformerProfile.Performer)
.Include(x => x.Location)
.Where(x=> x.ClientId == uid || x.PerformerId == uid)
.Where(x => x.ClientId == uid || x.PerformerId == uid)
.ToListAsync());
}
@ -107,11 +107,11 @@ namespace Yavsc.Controllers
);
if (pro == null)
return HttpNotFound();
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == activityCode);
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == activityCode);
ViewBag.GoogleSettings = _googleSettings;
var userid = User.GetUserId();
var user = _userManager.FindByIdAsync(userid).Result;
return View("Create",new RdvQuery(activityCode,new Location(),DateTime.Now.AddHours(4))
return View("Create", new RdvQuery(activityCode, new Location(), DateTime.Now.AddHours(4))
{
PerformerProfile = pro,
PerformerId = pro.PerformerId,
@ -152,11 +152,12 @@ namespace Yavsc.Controllers
if (ModelState.IsValid)
{
var existingLocation = _context.Locations.FirstOrDefault( x=>x.Address == command.Location.Address
&& x.Longitude == command.Location.Longitude && x.Latitude == command.Location.Latitude );
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;
if (existingLocation != null)
{
command.Location = existingLocation;
}
else _context.Attach<Location>(command.Location);
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
@ -170,26 +171,29 @@ namespace Yavsc.Controllers
&& pro.AcceptPublicContact)
{
try {
if (pro.Performer.Devices.Count > 0) {
try
{
_logger.LogInformation("sending GCM");
if (pro.Performer.Devices.Count > 0)
{
var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId);
grep = await _GCMSender.NotifyBookQueryAsync(regids,yaev);
grep = await _GCMSender.NotifyBookQueryAsync(regids, yaev);
}
_logger.LogError("sending GCM");
// 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;
ViewBag.GooglePayload = grep;
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
}
try {
try
{
ViewBag.EmailSent = await _emailSender.SendEmailAsync(
command.PerformerProfile.Performer.UserName,
command.PerformerProfile.Performer.Email,
@ -202,11 +206,11 @@ namespace Yavsc.Controllers
_logger.LogError(ex.Message);
}
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View("CommandConfirmation",command);
return View("CommandConfirmation", command);
}
ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == command.ActivityCode);
ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == command.ActivityCode);
ViewBag.GoogleSettings = _googleSettings;
return View(command);
}

Loading…