public HttpResponseMessage Insert(TTLAddRequest model) { int id = _ttlService.Insert(model); ItemResponse <int> resp = new ItemResponse <int>(); resp.Item = id; return(Request.CreateResponse(HttpStatusCode.OK, resp)); }
public int Insert(TTLAddRequest model) { int id = 0; _datapProvider.ExecuteNonQuery( "TopTenList_Insert", inputParamMapper : delegate(SqlParameterCollection paramList) { SqlParameter param = new SqlParameter(); param.ParameterName = "@Id"; param.SqlDbType = SqlDbType.Int; param.Direction = ParameterDirection.Output; paramList.Add(param); paramList.AddWithValue("@Name", model.Name); paramList.AddWithValue("@Url", model.Url); }, returnParameters : delegate(SqlParameterCollection paramList) { id = (int)paramList["@Id"].Value; }); return(id); }