public int Create(EventBriteSearchCriteriaCreate create) { int Id = 0; _dataProvider.ExecuteNonQuery( "EventBriteSearchCriteria_Insert", cmd => { cmd.AddWithValue("@CriteriaId", create.CriteriaId); cmd.AddWithValue("@CriteriaText", create.CriteriaText); cmd.AddWithValue("@TypeId", create.TypeId); //cmd.AddWithValue("@Id", SqlDbType.Int).Direction = ParameterDirection.Output; SqlParameter idParameter = new SqlParameter("@Id", SqlDbType.Int) { Direction = ParameterDirection.Output }; cmd.Add(idParameter); }, reader => { Id = (int)reader["@Id"].Value; } ); return(Id); }
public HttpResponseMessage Create(EventBriteSearchCriteriaCreate create) { if (create == null) { ModelState.AddModelError("empty object", "supply body"); } if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } int newId = _eventBriteService.Create(create); return(Request.CreateResponse(HttpStatusCode.OK, newId)); }