我想将我的AcievementViewModel的数据绑定到AchievementModel,我该如何实现呢?

时间:2019-01-29 13:23:03

标签: c# asp.net

我想将AchievementViewModel的数据绑定到AchievementModel,我该如何实现?

我正在尝试将此coz swagger生成模型作为swagger UI中的Example Value,我希望我的swagger UI隐藏ID和Date参数

 public class AchievementsModel
    {
        /// <summary>
        /// Maps object to MongoDb Collection
        /// </summary>
        [BsonId]
        [BsonIgnoreIfDefault]
        public ObjectId Id { get; set; }


        public static DateTime _dateOnly = DateTime.Today;

        //[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        [BsonElement("Date")]
        public string Date = _dateOnly.ToShortDateString();
        //public string Date = DateTime.Today.ToString();

        [BsonElement("Name")]
        public string EmpName { get; set; }

        [BsonElement("WeeklyAchievements")]
        public List<WeeklyAchievements> EmpAchievements { get; set; }

        [BsonElement("OrganizationalGrowth")]
        public List<OrganizationalGrowth> EmpGrowth { get; set; }

        [BsonElement("YourExperience")]
        public List<YourExperience> EmpExperience { get; set; }

        [BsonElement("Ratings")]
        public int EmpRating { get; set; }

        [BsonElement("Comments")]
        public List<Comments> EmpComments { get; set; }

        [BsonElement("Extramile")]
        public List<Extramile> EmpExtramile { get; set; }
    }



    public class AchievementsViewModel
    {

        public string EmpName { get; set; }       
        public long EmpMobileNumber { get; set; }      
        public List<WeeklyAchievements> EmpAchievements { get; set; }      
        public List<OrganizationalGrowth> EmpGrowth { get; set; }        
        public List<YourExperience> EmpExperience { get; set; }       
        public int EmpRating { get; set; }
        public List<Comments> EmpComments { get; set; }
        public List<Extramile> EmpExtramile { get; set; }

    }

0 个答案:

没有答案