public ActionResult DeleteWarnings(WarningDeleteViewModel[] warnings) { if (warnings != null) { foreach (var warning in warnings) { warningRepository.Remove(warning.WarningID); } warningRepository.SaveChanges(); } return(RedirectToAction("Index")); }
public SuccessResponse Delete(DeleteWarningRequest request) { try { var warning = _warningRepository.FindBy(request.Id); warning.ThrowExceptionIfRecordIsNull(); _warningRepository.Remove(warning); return(new SuccessResponse { IsSuccess = true }); } catch (DataAccessException) { throw new ApplicationException(); } }