コード例 #1
0
 /// <summary>
 /// Convert Corporate Entity  into Corporate Object
 /// </summary>
 ///<param name="model">MemberLicenseViewModel</param>
 ///<param name="CorporateEntity">DataAccess.Corporate</param>
 ///<returns>MemberLicenseViewModel</returns>
 public static MemberLicenseViewModel ToViewModel(this MemberLicense entity,
                                                  MemberLicenseViewModel model)
 {
     model.Id        = entity.Id;
     model.FinYearId = entity.FinYearId;
     model.MemberId  = entity.MemberId;
     model.MemberNo  = entity.Member.MemberNo;
     model.FullName  = entity.Member.Person.FullName;
     model.FinYear   = entity.FinYear.Name;
     model.LicenseNo = entity.LicenseNo;
     return(model);
 }
コード例 #2
0
        /// <summary>
        /// Convert Corporate Object into Corporate Entity
        /// </summary>
        ///<param name="model">Corporate</param>
        ///<param name="CorporateEntity">DataAccess.Corporate</param>
        ///<returns>DataAccess.Corporate</returns>
        public static MemberLicense ToEntity(this MemberLicenseViewModel model, MemberLicense entity
                                             )
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
            }
            else
            {
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }
            entity.FinYearId = model.FinYearId;
            entity.MemberId  = model.MemberId;
            entity.LicenseNo = model.LicenseNo;

            return(entity);
        }