public async Task DeleteFunctionNotExisted() { var id = _dbFaker.Functions.Max(l => l.Id) + 1; var result = await _securityData.DeleteFunction(id); var expectedMessage = $"Access Function with id = {id} was not found"; Assert.AreEqual(ActionStatus.Warning, result.Status); Assert.AreEqual(expectedMessage, result.Message); _mock.Verify(data => data.DeleteFunction(It.Is <int>(db => db == 0)), () => Times.Exactly(0)); }
public ActionResult DeleteFunction(string id) { var result = _functionService.DeleteFunction(id); if (!string.IsNullOrEmpty(result)) { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(result, JsonRequestBehavior.AllowGet)); } else { CurrentHttpContext.Response.StatusCode = (int)HttpStatusCode.OK; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public IHttpActionResult Delete(int functionID) { var response = service.DeleteFunction(functionID); return(Ok(response)); }
public async Task <IActionResult> DeleteFunction(int id) { var result = _securityService.DeleteFunction(id); return(Ok(await result)); }
public string DeleteFunction(long policyId, long id) { functionService.DeleteFunction(new PolicyId(policyId), new RuleFunctionId(id)); return("Function with " + id + "Deleted"); }
public string DeleteFunction(FunctionVO functionVO) { var result = _functionService.DeleteFunction(functionVO.FunctionID.ToString()); return(result); }