public IHttpActionResult Delete(int id) { Model_Task model_BAL_Task = db.DB_Tasks.Find(id); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != model_BAL_Task.TaskID) { return(BadRequest()); } try { BAL_Task.Delete(model_BAL_Task); } catch (DbUpdateConcurrencyException) { if (!BAL_Task.TaskExists(id)) { return(NotFound()); } else { throw; } } return(Ok(model_BAL_Task)); }
public IHttpActionResult Put(int id, Model_Task model_BAL_Task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != model_BAL_Task.TaskID) { return(BadRequest()); } try { BAL_Task.Put(model_BAL_Task); } catch (DbUpdateConcurrencyException) { if (!BAL_Task.TaskExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Post(Model_Task model_BAL_Task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } BAL_Task.Post(model_BAL_Task); return(CreatedAtRoute("DefaultApi", new { id = model_BAL_Task.TaskID }, model_BAL_Task)); }
public void Delete(Model_Task model_DAL_Task) { model_DAL_Task.IsCompleted = true; db.Entry(model_DAL_Task).State = EntityState.Modified; db.SaveChangesAsync(); }
public void Post(Model_Task model_DAL_Task) { db.DB_Tasks.Add(model_DAL_Task); db.SaveChangesAsync(); }
public void Put(Model_Task model_DAL_Task) { db.Entry(model_DAL_Task).State = EntityState.Modified; db.SaveChangesAsync(); }