public IHttpActionResult PutMonthlyBudget(Guid id, MonthlyBoojet monthlyBoojet) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != monthlyBoojet.Id) { return BadRequest(); } db.Entry(monthlyBoojet).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MonthlyBudgetExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult GetMonthlyBudget(Guid userId, int month, int year) { MonthlyBoojet monthlyBoojet = db.MonthlyBoojets.FirstOrDefault(); if (monthlyBoojet == null) { return NotFound(); } return Ok(monthlyBoojet); }
public IHttpActionResult PostMonthlyBudget(MonthlyBoojet monthlyBoojet) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.MonthlyBoojets.Add(monthlyBoojet); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = monthlyBoojet.Id }, monthlyBoojet); }
public IHttpActionResult DeleteMonthlyBudget(Guid id) { MonthlyBoojet monthlyBoojet = db.MonthlyBoojets.Find(id); if (monthlyBoojet == null) { return NotFound(); } db.MonthlyBoojets.Remove(monthlyBoojet); db.SaveChanges(); return Ok(monthlyBoojet); }