Пример #1
0
 public static Course ToEntity(this CourseModel model, Course course)
 {
     course                = course ?? new Course();
     course.Name           = model.Name;
     course.Description    = model.Description;
     course.CourseCategory = model.CourseCategory;
     course.AvailableFrom  = UtilCommon.ConvertDateTime(model.AvailableFrom, Constants.DATETIME_FORMAT);
     course.AvailableTo    = UtilCommon.ConvertDateTime(model.AvailableTo, Constants.DATETIME_FORMAT);
     course.CourseFee      = model.CourseFee;
     course.Id             = model.Id;
     return(course);
 }
Пример #2
0
        public static User ToEntity(this UserApiModel model, User entity)
        {
            if (entity == null)
            {
                entity = new User();
            }

            entity.Email       = model.Email;
            entity.FullName    = model.FullName;
            entity.LinkedSite  = model.LinkedSite;
            entity.Address     = model.Address;
            entity.Phone       = model.Phone;
            entity.Gender      = model.Gender;
            entity.DateOfBirth = UtilCommon.ConvertDateTime(model.DateOfBirth, Constants.DATETIME_FORMAT);
            entity.Id          = model.UserId;
            entity.Bio         = model.Bio;
            entity.Location    = model.Location;
            entity.Strength    = model.Strength;
            entity.Languages   = model.Languages;
            entity.UserName    = model.UserName;
            return(entity);
        }