|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Application.Domain.Entities;
|
|
|
|
|
using Application.Models;
|
|
|
|
|
using Infrastructure.Application;
|
|
|
|
@ -9,7 +8,8 @@ using Infrastructure.Web.Mvc;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using UserCenter.Services;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
|
{
|
|
|
|
@ -19,15 +19,12 @@ namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
|
{
|
|
|
|
|
private readonly IEncryptionService _encrypitonService;
|
|
|
|
|
private readonly AjaxController _ajax;
|
|
|
|
|
//private readonly FaceRecognitionService _frs;
|
|
|
|
|
|
|
|
|
|
public UserController(IRepository<User> userRepo, IEncryptionService encrypitonService, AjaxController ajax
|
|
|
|
|
//, FaceRecognitionService frs
|
|
|
|
|
) : base(userRepo)
|
|
|
|
|
{
|
|
|
|
|
this._encrypitonService = encrypitonService;
|
|
|
|
|
this._ajax = ajax;
|
|
|
|
|
//this._frs = frs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override IQueryable<User> Include(IQueryable<User> query)
|
|
|
|
@ -72,24 +69,23 @@ namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnEdit(User entity, EditUserModel model)
|
|
|
|
|
{
|
|
|
|
|
model.UserName = entity.UserName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnInserted(User entity)
|
|
|
|
|
{
|
|
|
|
|
//this._frs.AddFace(entity.UserName, entity.FaceImage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnUpdated(User entity)
|
|
|
|
|
public override IActionResult Add(EditUserModel model)
|
|
|
|
|
{
|
|
|
|
|
//this._frs.UpdateFace(entity.UserName, entity.FaceImage);
|
|
|
|
|
if (string.IsNullOrEmpty(model.Password))
|
|
|
|
|
{
|
|
|
|
|
ModelState.AddModelError("Password", "密码不能为空");
|
|
|
|
|
}
|
|
|
|
|
return base.Add(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnDeleted(User entity)
|
|
|
|
|
public override IActionResult Edit(EditUserModel model)
|
|
|
|
|
{
|
|
|
|
|
//this._frs.RemoveFace(entity.UserName);
|
|
|
|
|
var entity = this.Repo.Table().FirstOrDefault(o => o.Id == model.Id);
|
|
|
|
|
if (entity.UserName != model.UserName)
|
|
|
|
|
{
|
|
|
|
|
ModelState.AddModelError("UserName", "用户名不能修改");
|
|
|
|
|
}
|
|
|
|
|
return base.Edit(model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|