server/aspnetapp/Controllers/WebUI/PublicController.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using aspnetapp.Helper;
using aspnetapp.Models;
using Microsoft.AspNetCore.Mvc;
namespace aspnetapp.Controllers
{
public class PublicController : Controller
{
private readonly CounterContext _context;
public PublicController(CounterContext context)
{
_context = context;
}
public IActionResult DownloadFj(string id)
{
var att = _context.Templates.FirstOrDefault(m => m.Unid == id);
if (att != null && att.Filecon != null)
{
return File(att.Filecon.ToArray(), MimeMapping.GetMimeMapping(att.Filename), att.Filename);
}
else
{
return Content("");
}
}
public async Task<IActionResult> MCExcelAsync([FromForm(Name = "filecon")] IFormFile filecon)
{
if (filecon.Length > 0)
{
using (MemoryStream memoryStream = new MemoryStream())
{
await filecon.CopyToAsync(memoryStream);
byte[] con = memoryStream.ToArray();
var q = _context.Templates.FirstOrDefault(s => s.Type == (int)EnumCode.ExportFill.早餐模板Excel);
if (q == null)
{
var t = new TemplateEntity();
t.Unid = Guid.NewGuid().ToString();
t.Bz = filecon.FileName.Substring(0, filecon.FileName.LastIndexOf("."));
t.Filename = filecon.FileName;
t.Createdate = DateTime.Now;
t.Filecon = con;
t.Type = (int)EnumCode.ExportFill.早餐模板Excel;
_context.Templates.Add(t);
}
else
{
q.Bz = filecon.FileName.Substring(0, filecon.FileName.LastIndexOf("."));
q.Filename = filecon.FileName;
q.Createdate = DateTime.Now;
q.Filecon = con;
}
_context.SaveChanges();
}
}
return Json(new { state = "ok" });
}
后面还有 72 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。