public JsonResult Delete(int id, FormCollection collection) { ResponseMessage responseMessage = null; try { _service.Delete(id); responseMessage = new ResponseMessage(MessageType.Success) { Status = true, Message = "Record successfully deleted.", Title = "Delete record.", }; } catch (Exception e) { responseMessage = new ResponseMessage(MessageType.Failure) { Status = false, Message = e.Message, Title = "Error Deleting record." }; } return Json(responseMessage); }
public async Task Delete_ThrowsException() { await Assert.ThrowsAsync <CashSchedulerException>(() => TransactionTypeService.Delete(TransactionType.Options.Income.ToString())); await Assert.ThrowsAsync <CashSchedulerException>(() => TransactionTypeService.Delete(TransactionType.Options.Expense.ToString())); }