public async Task <IHttpActionResult> PostBudgetVarianceReason(BudgetVarianceReason budgetVarianceReason)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.BudgetVarianceReasons.Add(budgetVarianceReason);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (BudgetVarianceReasonExists(budgetVarianceReason.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = budgetVarianceReason.Id }, budgetVarianceReason));
        }
        public async Task <IHttpActionResult> PutBudgetVarianceReason(int id, BudgetVarianceReason budgetVarianceReason)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != budgetVarianceReason.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BudgetVarianceReasonExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GetBudgetVarianceReason(int id)
        {
            BudgetVarianceReason budgetVarianceReason = await db.BudgetVarianceReasons.FindAsync(id);

            if (budgetVarianceReason == null)
            {
                return(NotFound());
            }

            return(Ok(budgetVarianceReason));
        }
        public async Task <IHttpActionResult> DeleteBudgetVarianceReason(int id)
        {
            BudgetVarianceReason budgetVarianceReason = await db.BudgetVarianceReasons.FindAsync(id);

            if (budgetVarianceReason == null)
            {
                return(NotFound());
            }

            db.BudgetVarianceReasons.Remove(budgetVarianceReason);
            await db.SaveChangesAsync();

            return(Ok(budgetVarianceReason));
        }