EF7 npgsql => ko aux clients => inutile en lib [obsdnx]
parent
4ae095ccb3
commit
4e3845755b
@ -1,13 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace Yavsc.Models.Relationship
|
|
||||||
{
|
|
||||||
public class LocationType
|
|
||||||
{
|
|
||||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.Hosting.Server;
|
|
||||||
using Microsoft.AspNet.Http.Features;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Yavsc.Models;
|
|
||||||
|
|
||||||
namespace Yavsc.Server
|
|
||||||
{
|
|
||||||
public class YavscServerFactory : IServerFactory
|
|
||||||
{
|
|
||||||
public IFeatureCollection Initialize(IConfiguration configuration)
|
|
||||||
{
|
|
||||||
FeatureCollection featureCollection = new FeatureCollection();
|
|
||||||
return featureCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
|
|
||||||
{
|
|
||||||
var task = application(serverFeatures);
|
|
||||||
return task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
using Microsoft.AspNet.Authorization;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Auth;
|
||||||
|
using Yavsc.Helpers;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
|
|
||||||
|
namespace Yavsc.ApiControllers.accounting
|
||||||
|
{
|
||||||
|
[Route("~/api/profile")]
|
||||||
|
public class ProfileApiController: Controller
|
||||||
|
{
|
||||||
|
UserManager<ApplicationUser> _userManager;
|
||||||
|
ApplicationDbContext _dbContext;
|
||||||
|
public ProfileApiController(ApplicationDbContext dbContext, UserManager<ApplicationUser> userManager)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
_userManager = userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("memail/{allow}")]
|
||||||
|
public async Task<object> SetMonthlyEmail(bool allow)
|
||||||
|
{
|
||||||
|
var user = await _userManager.FindByIdAsync(User.GetUserId());
|
||||||
|
user.AllowMonthlyEmail = allow;
|
||||||
|
_dbContext.SaveChanges(User.GetUserId());
|
||||||
|
return Ok(new { monthlyEmailPrefSaved = allow });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue