public HttpResponseMessage Delete(int id) { ClassRepository repo = new ClassRepository(); repo.Delete(id); return(this.Request.CreateResponse(HttpStatusCode.OK)); }
public ActionResult Delete(ClassModel model) { var @class = _classRepository.GetById(model.Id); if (@class != null) { // Remove the class from the database. _classRepository.Delete(@class); } return(RedirectToAction("List")); }
public IHttpActionResult Delete(int id) { var result = classRepo.GetById(id); if (result == null) { return(Content(HttpStatusCode.NotFound, "Item does not exist")); } classRepo.Delete(id); return(Ok()); }
public ActionResult Delete(Guid id, FormCollection collection) { try { // TODO: Add delete logic here classRepository.Delete(id); return(RedirectToAction("Index")); } catch { return(View("Delete")); } }
public ActionResult Delete(string id) { var classRepository = new ClassRepository(_context); var uploader = new SupportMaterialUploader(id); var klass = classRepository.GetById(new Guid(id)); using (var tx = new TransactionScope()) { foreach (var file in klass.Files) { uploader.DeleteFile(file.PhysicalPath); } classRepository.Delete(klass.Id); _context.Save(_loggedUser); tx.Complete(); } return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
public void Delete(int Id) { sqlClassRepository.Delete(Id); }
//[AdminAuthorization] public IHttpActionResult DeleteClass(int id) { classrepo.Delete(id); return(StatusCode(HttpStatusCode.NoContent)); }
[HttpDelete("{Id}")] /*POSTMAN OK*/ public IActionResult Delete(int Id) { _classRepo.Delete(Id); return(Ok()); }