public void DeleteTest() { bool actual = _sampleService.Delete(new EFSample() { Id = _testID }); Assert.IsTrue(actual); }
public JsonResult DeleteSample(int id) { var result = _sampleService.Delete(id); return(Json(new { success = result })); }
public async Task <IActionResult> Delete(int id) { if (id <= 0) { return(BadRequest(Messages.InvalidRequest)); } var result = await sampleService.Delete(id); return(Ok(result)); }
public ActionResult Delete(int id) { try { _sampleService.Delete(id); } catch (RetryLimitExceededException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. return(RedirectToAction("Delete", new { id = id, saveChangesError = true })); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int id) { try { var result = await _sampleService.Delete(id); if (result > 0) { return(BaseOk()); } return(BaseBadRequest()); } catch (Exception ex) { _logger.LogError(ex, ex.Message); return(StatusCode(500, ex.Message)); } }
public IActionResult Delete(string id) { if (string.IsNullOrEmpty(id)) { return(BadRequest(Messages.InvalidRequest)); } var sample = sampleService.Get(id); if (sample.Data == null) { return(NotFound(Messages.NotFound)); } var result = sampleService.Delete(id); return(!result.IsSuccess ? Problem(Messages.GeneralError) : Ok(result.Message)); }
public IActionResult Delete(int Id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _sampleService.Delete(Id); return(Ok("Example deleted sucessfuly!")); } catch (ApplicationException appException) { return(NotFound(appException.Message)); } catch (Exception) { return(StatusCode(500)); } }
public async Task <IHttpActionResult> Delete(int id) { var sample = new Sample() { Id = id }; var result = await Task.Run(() => _sampleService.Delete(sample)); _memCache.Delete(_key); if (!result) { return(NotFound()); } return(Ok(new BaseResponse <string> { IsSuccess = true, Message = HttpResponseCode.OK.GetDescription() })); }