public IHttpActionResult PostIncome_Category(Income_Category income_Category) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Income_Category.Add(income_Category); try { db.SaveChanges(); } catch (DbUpdateException) { if (Income_CategoryExists(income_Category.IncomeCategoryId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = income_Category.IncomeCategoryId }, income_Category)); }
public IHttpActionResult PutIncome_Category(decimal id, Income_Category income_Category) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != income_Category.IncomeCategoryId) { return(BadRequest()); } db.Entry(income_Category).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Income_CategoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetIncome_Category(decimal id) { Income_Category income_Category = db.Income_Category.Find(id); if (income_Category == null) { return(NotFound()); } return(Ok(income_Category)); }
public IHttpActionResult DeleteIncome_Category(decimal id) { Income_Category income_Category = db.Income_Category.Find(id); if (income_Category == null) { return(NotFound()); } db.Income_Category.Remove(income_Category); db.SaveChanges(); return(Ok(income_Category)); }