Skip to content

Instantly share code, notes, and snippets.

View sdanna's full-sized avatar

Steven D'Anna sdanna

View GitHub Profile
@sdanna
sdanna / NewHotness.cs
Created December 9, 2013 17:15
How to convert a web api version 1 HttpResponseMessage based code base to a web api version 2 IHttpActionResult based code base. (http://weblogs.asp.net/dwahlin/archive/2013/11/11/new-features-in-asp-net-web-api-2-part-i.aspx)
public IHttpActionResult Post([FromBody]Customer cust)
{
var newCust = _Repository.InsertCustomer(cust);
if (newCust != null)
{
return Created<Customer>(Request.RequestUri + newCust.ID.ToString(), newCust);
}
else
{
return Conflict();
$.fn.extend({
trackChanges: function() {
$(":input", this).keyup(function() {
$(this.form).data("changed", true);
});
var form = $(this);
$(form).submit(function() {
form.data("submitted", true);
@sdanna
sdanna / ComboNumericHeaderCell.cs
Created May 4, 2012 19:13
Winforms DataGridView Column with a custom header (Combobox + NumericUpDown control in this instance)
public class ComboNumericHeaderCell : DataGridViewColumnHeaderCell
{
public readonly ComboBox _comboBox;
public readonly NumericUpDown _numericUpDown;
public ComboNumericHeaderCell()
{
_comboBox = new ComboBox();
_numericUpDown = new NumericUpDown();
_comboBox.Font = Control.DefaultFont;