示例#1
0
 /// <summary>
 /// Convert RunningCategory Entity  into RunningCategory Object
 /// </summary>
 ///<param name="model">RunningCategoryViewModel</param>
 ///<param name="RunningCategoryEntity">DataAccess.RunningCategory</param>
 ///<returns>RunningCategoryViewModel</returns>
 public static RunningCategoryViewModel ToViewModel(
     this DataAccess.RunningCategory entity,
     RunningCategoryViewModel model)
 {
     model.Id       = entity.Id;
     model.Name     = entity.Name;
     model.IsActive = entity.IsActive;
     return(model);
 }
示例#2
0
        /// <summary>
        /// Convert RunningCategory Object into RunningCategory Entity
        /// </summary>
        ///<param name="model">RunningCategory</param>
        ///<param name="RunningCategoryEntity">DataAccess.RunningCategory</param>
        ///<returns>DataAccess.RunningCategory</returns>
        public static DataAccess.RunningCategory ToEntity(this RunningCategoryViewModel model,
                                                          DataAccess.RunningCategory entity)
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
                entity.IsActive      = model.IsActive;
            }
            else
            {
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }
            entity.Name = model.Name;

            return(entity);
        }