public async Task <IActionResult> Delete(string id, string contactType) { try { var result = await Repository.GetItemAsync(id, contactType); if (result is null || result.Item2 is null) { return(BadRequest()); } await Repository.DeleteItemAsync(id, contactType); } catch (Exception e) { Logger.LogError(e.ToString()); throw e; } return(Ok()); }
public async Task <ActionResult> Delete(Contact contact) { try { if (!string.IsNullOrEmpty(contact.Id)) { // TODO: Add delete logic here await Repository.DeleteItemAsync(contact.Id, contact.ContactType.ToString()); return(RedirectToAction(nameof(Index))); } else { throw new Exception(); } } catch { ViewBag.Area = Constants.LeadArea; ViewBag.Error = "Unable to delete record."; return(View(contact)); } }