public JsonResult DeleteVendor(int IdVendor) { try { dt = service.DeleteVendor(IdVendor); data.result = JsonConvert.SerializeObject(dt, Formatting.Indented); if ((int)dt.Rows[0][0] == 1) { data.message = "Se elimino correctamente"; jsonString = JsonConvert.SerializeObject(data); } else { data.message = "Error en la operaciĆ³n, o no se puede eliminar porque el vendedor tiene prestamos asociados"; data.status = "error"; } data.result = JsonConvert.SerializeObject(dt, Formatting.Indented); } catch (Exception ex) { data.message = ex.Message; data.status = "error"; return(Json(data, JsonRequestBehavior.AllowGet)); } return(Json(data, JsonRequestBehavior.AllowGet));; }
public async Task DeleteVendor_ValidArguments_SoftDeleteAndPublishEvent() { var vendor = new Vendor(); await _vendorService.DeleteVendor(vendor); //soft delete Assert.IsTrue(vendor.Deleted); _mediatorMock.Verify(c => c.Publish(It.IsAny <EntityUpdated <Vendor> >(), default(CancellationToken)), Times.Once); }