Beispiel #1
0
        /// <summary>
        /// getMaritals
        /// </summary>
        /// <returns></returns>
        public List <MaritalStatusModel> getMaritals()
        {
            List <MaritalStatusModel> maritalStatusList = new List <MaritalStatusModel>();

            try
            {
                var dbManager = new DBManager(connectionStringSettings.Name);
                var dataTable = dbManager.getDataTable("SP_GET_MARITAL_STATUS", CommandType.StoredProcedure);
                if (null != dataTable && dataTable.Rows.Count > 0)
                {
                    MaritalStatusModel maritalStatusModel = null;
                    foreach (DataRow row in dataTable.Rows)
                    {
                        maritalStatusModel = new MaritalStatusModel();
                        maritalStatusModel.MaritalStatusId = row["MARITAL_STATUS_ID"] as int? ?? 0;
                        maritalStatusModel.MaritalStatus   = row["MARITAL_STATUS"] as string ?? string.Empty;
                        maritalStatusList.Add(maritalStatusModel);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(maritalStatusList);
        }
Beispiel #2
0
 public static MaritalStatus ToEntity(this MaritalStatusModel model)
 {
     return(new MaritalStatus
     {
         Id = model.Id,
         Title = model.Title
     });
 }
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static MaritalStatusViewModel ToViewModel(this MaritalStatusModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new MaritalStatusViewModel
            {
                MaritalStatusID = model.MaritalStatusID,
                MaritalStatus   = model.MaritalStatus
            };

            return(entity);
        }
        /// <summary>
        /// To the model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static MaritalStatusModel ToModel(this MaritalStatusViewModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new MaritalStatusModel
            {
                MaritalStatusID = entity.MaritalStatusID,
                MaritalStatus   = entity.MaritalStatus
            };

            return(model);
        }