Пример #1
0
 /// <summary>
 /// Convert SystemDocument Entity  into SystemDocument Object
 /// </summary>
 ///<param name="SystemDocumentEntity">DataAccess.SystemDocument</param>
 ///<returns>SystemDocumentViewModel</returns>
 public static SystemDocumentViewModel ToViewModel(
     this DataAccess.SystemDocument entity, SystemDocumentViewModel model)
 {
     model.SessionUserId    = entity.CreatedUserId;
     model.Id               = entity.Id;
     model.DocumentId       = entity.DocumentId;
     model.DocumentNameGuId = entity.Document.DocumentNameGuid;
     model.DocumentName     = entity.Document.Name;
     model.FinYearId        = entity.FinYearId;
     model.IsActive         = entity.IsActive;
     model.Ordinal          = entity.Ordinal;
     return(model);
 }
Пример #2
0
        /// <summary>
        /// Convert SystemDocument Object into SystemDocument Entity
        /// </summary>
        ///<param name="model">SystemDocument</param>
        ///<param name="SystemDocumentEntity">DataAccess.SystemDocument</param>
        ///<returns>DataAccess.SystemDocument</returns>
        public static DataAccess.SystemDocument ToEntity(
            this SystemDocumentViewModel model,
            DataAccess.SystemDocument entity
            )
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
            }
            else
            {
                entity.IsActive         = model.IsActive;
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }
            entity.DocumentId = model.DocumentId;
            entity.Ordinal    = model.Ordinal;
            entity.FinYearId  = model.FinYearId;


            return(entity);
        }