Ejemplo n.º 1
0
 /// <summary>
 /// Convert OrganisationType Entity  into OrganisationType Object
 /// </summary>
 ///<param name="model">OrganisationTypeViewModel</param>
 ///<param name="OrganisationTypeEntity">DataAccess.OrganisationType</param>
 ///<returns>OrganisationTypeViewModel</returns>
 public static OrganisationTypeViewModel ToViewModel(
     this DataAccess.OrganisationType entity,
     OrganisationTypeViewModel model)
 {
     model.Id       = entity.Id;
     model.Name     = entity.Name;
     model.IsActive = entity.IsActive;
     return(model);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Convert OrganisationType Object into OrganisationType Entity
        /// </summary>
        ///<param name="model">OrganisationType</param>
        ///<param name="OrganisationTypeEntity">DataAccess.OrganisationType</param>
        ///<returns>DataAccess.OrganisationType</returns>
        public static DataAccess.OrganisationType ToEntity(this OrganisationTypeViewModel model,
                                                           DataAccess.OrganisationType 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);
        }