重构代码:由于Bootstrap.Security组件移除了对Longbow.Loggin组件的引用,增加对其引用
This commit is contained in:
parent
52427c77b2
commit
2a808a8de4
|
@ -9,6 +9,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="1.0.0" />
|
||||
<PackageReference Include="Longbow.Logging" Version="1.0.1" />
|
||||
<PackageReference Include="Longbow.Web" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0" PrivateAssets="All" />
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using Longbow.Logging;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -33,25 +31,13 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
var filePath = Path.Combine(env.WebRootPath, webSiteUrl.Replace("~", string.Empty).Replace("/", "\\").TrimStart('\\') + fileName);
|
||||
var fileFolder = Path.GetDirectoryName(filePath);
|
||||
fileSize = uploadFile.Length;
|
||||
try
|
||||
if (!Directory.Exists(fileFolder)) Directory.CreateDirectory(fileFolder);
|
||||
using (var fs = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
if (!Directory.Exists(fileFolder)) Directory.CreateDirectory(fileFolder);
|
||||
using (var fs = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
await uploadFile.CopyToAsync(fs);
|
||||
}
|
||||
previewUrl = string.Format("{0}?q={1}", Url.Content(fileUrl), DateTime.Now.Ticks);
|
||||
UserHelper.SaveUserIconByName(userName, fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var nv = new NameValueCollection
|
||||
{
|
||||
{ "UpLoadFileName", filePath }
|
||||
};
|
||||
error = ex.Message;
|
||||
ExceptionManager.Publish(ex, nv);
|
||||
await uploadFile.CopyToAsync(fs);
|
||||
}
|
||||
previewUrl = string.Format("{0}?q={1}", Url.Content(fileUrl), DateTime.Now.Ticks);
|
||||
UserHelper.SaveUserIconByName(userName, fileName);
|
||||
}
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue