コード例 #1
0
 private static void AddCommonParams(ExternalLinkAddRequest model, SqlParameterCollection col)
 {
     col.AddWithValue("@UserId", model.UserId);
     col.AddWithValue("@UrlTypeId", model.UrlTypeId);
     col.AddWithValue("@Url", model.Url);
     col.AddWithValue("@EntityId", model.EntityId);
     col.AddWithValue("@EntityTypeId", model.EntityTypeId);
 }
コード例 #2
0
        public int Add(ExternalLinkAddRequest model)
        {
            int id = 0;

            string procName = "[dbo].[ExternalLinks_Insert]";

            _dataProvider.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection col)
            {
                AddCommonParams(model, col);

                SqlParameter idOut = new SqlParameter("@Id", SqlDbType.Int);
                idOut.Direction    = ParameterDirection.Output;

                col.Add(idOut);
            }, returnParameters : delegate(SqlParameterCollection returnCollection)
            {
                object oId = returnCollection["@Id"].Value;
                int.TryParse(oId.ToString(), out id);
            });

            return(id);
        }