public int InsertTelephone(TelephoneAddRequest model) { int Id = 0; _dataProvider.ExecuteNonQuery( "Telephone_Insert", inputParamMapper : delegate(SqlParameterCollection paramList) { SqlParameter parm = new SqlParameter { ParameterName = "@Id", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output }; paramList.Add(parm); paramList.AddWithValue("@PhoneNumber", model.PhoneNumber); paramList.AddWithValue("@Extension", model.Extension); paramList.AddWithValue("@PhoneType", model.PhoneType); paramList.AddWithValue("@ModifiedBy", model.ModifiedBy); }, returnParameters : delegate(SqlParameterCollection paramList) { Id = (int)paramList["@Id"].Value; }); return(Id); }
public HttpResponseMessage TelephoneInsert(TelephoneAddRequest model) { try { int Id = _profileDataService.InsertTelephone(model); ItemResponse <int> resp = new ItemResponse <int>(); resp.Item = Id; log.Info("ProfileData Insert Telephone Success"); return(Request.CreateResponse(HttpStatusCode.OK, resp)); } catch (Exception ex) { log.Error("ProfileData Insert Telephone Error", ex); return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }