Example #1
0
        public static ViewCenters ToViewModel(Centers model)
        {
            if (model == null)
            {
                return(null);
            }

            ViewCenters item = new ViewCenters();

            item.CenterId          = model.CenterId;
            item.Uid               = model.Uid;
            item.CenterAddress     = model.CenterAddress;
            item.DistrictID        = model.DistrictID;
            item.CityID            = model.CityID;
            item.ProvinceID        = model.ProvinceID;
            item.CountryID         = model.CountryID;
            item.CreateDate        = model.CreateDate;
            item.UpgradeDate       = model.UpgradeDate;
            item.CenterProfile     = model.CenterProfile;
            item.OpenTime          = model.OpenTime == null ? "" : DateTime.Parse(model.OpenTime.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            item.CloseTime         = model.CloseTime == null ? "" : DateTime.Parse(model.CloseTime.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            item.CenterName        = model.CenterName;
            item.CenterType        = model.CenterType;
            item.CenterBanner      = model.CenterBanner;
            item.CenterIntrodition = model.CenterIntroduction;
            item.CenterPortraint   = model.CenterPortrait;
            item.YogaTypeid        = model.YogaTypeid;
            item.CenterSource      = model.CenterSource;
            item.CenterState       = model.CenterState;
            return(item);
        }
Example #2
0
        public static Centers ToEntity(ViewCenters model)
        {
            Centers item = new Centers();

            item.CenterId           = model.CenterId;
            item.Uid                = model.Uid;
            item.CenterAddress      = model.CenterAddress;
            item.DistrictID         = model.DistrictID;
            item.CityID             = model.CityID;
            item.ProvinceID         = model.ProvinceID;
            item.CountryID          = model.CountryID;
            item.CreateDate         = model.CreateDate;
            item.UpgradeDate        = model.UpgradeDate;
            item.CenterProfile      = model.CenterProfile;
            item.OpenTime           = Convert.ToDateTime(model.OpenTime);
            item.CloseTime          = Convert.ToDateTime(model.CloseTime);
            item.CenterName         = model.CenterName;
            item.CenterType         = model.CenterType;
            item.CenterBanner       = model.CenterBanner;
            item.CenterIntroduction = model.CenterIntrodition;
            item.CenterPortrait     = model.CenterPortraint;
            item.YogaTypeid         = model.YogaTypeid;
            item.CenterState        = model.CenterState;
            item.CenterSource       = model.CenterSource;

            return(item);
        }