班级中的当前用户

罗宾·格鲁特

我想获取当前用户并在我创建新文章时填写当前用户,就像我在创建文章时创建新日期一样。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;

namespace CeeLearnAndDo.Models
{
    public class Article
    {
        public int Id { get; set; }
        public string CurentUser { get; set; }
        public string Title { get; set; }
        public DateTime CreationDate { get; set; }
        public string Content { get; set; }
        public Article()
        {
            CreationDate = DateTime.Now;
            CurentUser = 
        }
    }
}

如果您需要更多信息,请询问我。

艾琳·耶尔马兹
CurentUser = User.Identity.Name;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章