public IHttpActionResult PutWorkOrder(int id, WorkOrder workOrder)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != workOrder.WorkOrderId)
            {
                return BadRequest();
            }

            db.Entry(workOrder).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkOrderExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostWorkOrder(WorkOrder workOrder)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.WorkOrders.Add(workOrder);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = workOrder.WorkOrderId }, workOrder);
        }
        public IHttpActionResult PostWorkOrder(WorkOrderModel workOrder)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var dbWorkOrder = new WorkOrder(workOrder);

            db.WorkOrders.Add(dbWorkOrder);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = dbWorkOrder.WorkOrderId }, Mapper.Map<WorkOrderModel>(workOrder));
        }
        public IHttpActionResult PostWorkOrder(WorkOrderModel workOrder)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var dbWorkOrder = new WorkOrder();
            dbWorkOrder.User = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name);
            dbWorkOrder.Update(workOrder);

            db.WorkOrders.Add(dbWorkOrder);
            db.SaveChanges();

            workOrder.WorkOrderId = dbWorkOrder.WorkOrderId;

            return CreatedAtRoute("DefaultApi", new { id = workOrder.WorkOrderId }, workOrder);
        }
        public IHttpActionResult PostWorkOrder(WorkOrderModel workOrder)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var dbWorkOrder = new WorkOrder();

            // Lease doesn't need the following code in POST because it's not being created directly by the user
            // dbWorkOrder.User = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name);

            dbWorkOrder.Update(workOrder);

            db.WorkOrders.Add(dbWorkOrder);
            db.SaveChanges();

            workOrder.WorkOrderId = dbWorkOrder.WorkOrderId;

            return CreatedAtRoute("DefaultApi", new { id = workOrder.WorkOrderId }, workOrder);
        }