EF7 npgsql => ko aux clients => inutile en lib [obsdnx]

This commit is contained in:
Paul Schneider 2018-05-04 17:04:19 +02:00
commit 09039fa9ee
495 changed files with 913 additions and 11207 deletions

View file

@ -120,7 +120,8 @@ namespace Yavsc.Controllers
DiskQuota = user.DiskQuota,
DedicatedCalendarId = user.DedicatedGoogleCalendar,
EMail = user.Email,
EmailConfirmed = await _userManager.IsEmailConfirmedAsync(user)
EmailConfirmed = await _userManager.IsEmailConfirmedAsync(user),
AllowMonthlyEmail = user.AllowMonthlyEmail
};
model.HaveProfessionalSettings = _dbContext.Performers.Any(x => x.PerformerId == user.Id);
var usrActs = _dbContext.UserActivities.Include(a=>a.Does).Where(a=> a.UserId == user.Id).ToArray();
@ -128,9 +129,31 @@ namespace Yavsc.Controllers
var usrActToSet = usrActs.Where( a => ( a.Settings == null && a.Does.SettingsClassName != null )).ToArray();
model.HaveActivityToConfigure = usrActToSet .Count()>0;
model.Activity = _dbContext.UserActivities.Include(a=>a.Does).Where(u=>u.UserId == user.Id).ToList();
return View(model);
}
[HttpGet]
public async Task<IActionResult> ProfileEMailUsage ()
{
var user = await GetCurrentUserAsync();
return View("ProfileEMailUsage", new ProfileEMailUsageViewModel(user));
}
[HttpPost]
public async Task<IActionResult> ProfileEMailUsage (ProfileEMailUsageViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
// Generate the token and send it
var user = await GetCurrentUserAsync();
user.AllowMonthlyEmail = model.Allow;
await this._dbContext.SaveChangesAsync(User.GetUserId());
return RedirectToAction(nameof(Index), new { Message = ManageMessageId.SetMonthlyEmailSuccess });
}
//
// POST: /Manage/RemoveLogin
@ -581,10 +604,10 @@ namespace Yavsc.Controllers
{
if (uid == model.PerformerId)
{
bool addrexists = _dbContext.Map.Any(x => model.OrganizationAddress.Id == x.Id);
bool addrexists = _dbContext.Locations.Any(x => model.OrganizationAddress.Id == x.Id);
if (!addrexists)
{
_dbContext.Map.Add(model.OrganizationAddress);
_dbContext.Locations.Add(model.OrganizationAddress);
}
if (_dbContext.Performers.Any(p=>p.PerformerId == uid))

View file

@ -44,7 +44,7 @@ namespace Yavsc.Controllers
// GET: Users/Create
public IActionResult Create()
{
ViewData["PostalAddressId"] = new SelectList(_context.Map, "Id", "PostalAddress");
ViewData["PostalAddressId"] = new SelectList(_context.Locations, "Id", "PostalAddress");
return View();
}
@ -59,7 +59,7 @@ namespace Yavsc.Controllers
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewData["PostalAddressId"] = new SelectList(_context.Map, "Id", "PostalAddress", applicationUser.PostalAddressId);
ViewData["PostalAddressId"] = new SelectList(_context.Locations, "Id", "PostalAddress", applicationUser.PostalAddressId);
return View(applicationUser);
}
@ -76,7 +76,7 @@ namespace Yavsc.Controllers
{
return HttpNotFound();
}
ViewData["PostalAddressId"] = new SelectList(_context.Map, "Id", "PostalAddress", applicationUser.PostalAddressId);
ViewData["PostalAddressId"] = new SelectList(_context.Locations, "Id", "PostalAddress", applicationUser.PostalAddressId);
return View(applicationUser);
}
@ -91,7 +91,7 @@ namespace Yavsc.Controllers
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewData["PostalAddressId"] = new SelectList(_context.Map, "Id", "PostalAddress", applicationUser.PostalAddressId);
ViewData["PostalAddressId"] = new SelectList(_context.Locations, "Id", "PostalAddress", applicationUser.PostalAddressId);
return View(applicationUser);
}

View file

@ -1,120 +0,0 @@
using System.Linq;
using Microsoft.AspNet.Mvc;
namespace Yavsc.Controllers
{
using System.Security.Claims;
using Models;
using Models.Relationship;
public class LocationTypesController : Controller
{
private ApplicationDbContext _context;
public LocationTypesController(ApplicationDbContext context)
{
_context = context;
}
// GET: LocationTypes
public IActionResult Index()
{
return View(_context.LocationType.ToList());
}
// GET: LocationTypes/Details/5
public IActionResult Details(long? id)
{
if (id == null)
{
return HttpNotFound();
}
LocationType locationType = _context.LocationType.Single(m => m.Id == id);
if (locationType == null)
{
return HttpNotFound();
}
return View(locationType);
}
// GET: LocationTypes/Create
public IActionResult Create()
{
return View();
}
// POST: LocationTypes/Create
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Create(LocationType locationType)
{
if (ModelState.IsValid)
{
_context.LocationType.Add(locationType);
_context.SaveChanges(User.GetUserId());
return RedirectToAction("Index");
}
return View(locationType);
}
// GET: LocationTypes/Edit/5
public IActionResult Edit(long? id)
{
if (id == null)
{
return HttpNotFound();
}
LocationType locationType = _context.LocationType.Single(m => m.Id == id);
if (locationType == null)
{
return HttpNotFound();
}
return View(locationType);
}
// POST: LocationTypes/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public IActionResult Edit(LocationType locationType)
{
if (ModelState.IsValid)
{
_context.Update(locationType);
_context.SaveChanges(User.GetUserId());
return RedirectToAction("Index");
}
return View(locationType);
}
// GET: LocationTypes/Delete/5
[ActionName("Delete")]
public IActionResult Delete(long? id)
{
if (id == null)
{
return HttpNotFound();
}
LocationType locationType = _context.LocationType.Single(m => m.Id == id);
if (locationType == null)
{
return HttpNotFound();
}
return View(locationType);
}
// POST: LocationTypes/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public IActionResult DeleteConfirmed(long id)
{
LocationType locationType = _context.LocationType.Single(m => m.Id == id);
_context.LocationType.Remove(locationType);
_context.SaveChanges(User.GetUserId());
return RedirectToAction("Index");
}
}
}