public IActionResult DeleteConfirmed(int id) { try { _ban.DeleteBanner(id); // TODO: Add delete logic here return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction("Error", "Home")); } }
public async Task <IActionResult> DeleteBanner(string id) { bool IsDeleted = false; try { IsDeleted = await _bannerRepository.DeleteBanner(id); } catch (Exception ex) { _log.Error("Error in DeleteBanner method of BannerController :" + Environment.NewLine + ex.StackTrace); } if (IsDeleted) { return(Ok()); } else { return(BadRequest()); // if there is no data relevant to ID } }