Beispiel #1
0
        public EngineCodeMapping EngineCodeMappingSave(EngineCodeMapping mapping)
        {
            var retVal = mapping;

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@ProgrammeId", mapping.ProgrammeId, DbType.Int32);
                    para.Add("@EngineId", mapping.EngineId, DbType.Int32);
                    para.Add("@ExternalEngineCode",
                             string.IsNullOrEmpty(mapping.ExternalEngineCode) ? null : mapping.ExternalEngineCode, DbType.String);
                    para.Add("@MappingId", null, DbType.Int32, ParameterDirection.Output);

                    conn.Execute("dbo.Fdp_EngineCode_Save", para, commandType: CommandType.StoredProcedure);

                    if (!mapping.MappingId.HasValue)
                    {
                        mapping.MappingId = para.Get <int>("@MappingId");
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return(mapping);
        }
 public EngineCodeMapping UpdateEngineCodeMapping(EngineCodeMapping mapping)
 {
     return(_programmeDataStore.EngineCodeMappingSave(mapping));
 }