public async Task <IActionResult> DeleteContact(int?contactId) { int result = 0; //Validation on server if (contactId == null) { return(BadRequest()); } try { result = await _cManager.DeleteContact(contactId); if (result == 0) { return(NotFound()); } return(Ok()); } catch (Exception) { return(BadRequest()); } }
public async Task <IActionResult> DeleteContact(int?contactId) { int result = 0; if (contactId == null) { return(BadRequest()); } try { SerilogManager.Information("deleting contact details for contact id" + contactId); result = await contactManager.DeleteContact(contactId); if (result == 0) { return(NotFound()); } return(Ok()); } catch (Exception ex) { SerilogManager.Error("Getting error in deleting contact: " + ex.Message); return(BadRequest()); } }
public int DeleteContact(int id) { if (id > 0) { _manager.DeleteContact(id); } return(id); }
public IActionResult DeleteContact(int id) { try { _contactManager.DeleteContact(id); return(Ok()); } catch (Exception ex) { return(BadRequest(Util.ErrorResponse.FormatResponse("Something went wrong!", ex.Message))); } }
public IActionResult Delete(int id) { try { contactManager.DeleteContact(id); return(new ObjectResult("Phone deleted successfully!")); } catch (Exception ex) { return(new ObjectResult(ex.Message)); } }
public async Task <IActionResult> DeleteContact(int contactId) { try { await _contactManager.DeleteContact(contactId); return(Ok(new { successMessage = SuccessOrErrorMessage.CONTACT_DELETION_SUCCESS })); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <IActionResult> DeleteContact(int id) { try { var result = await contactManager.DeleteContact(id); if (result == true) { return(NoContent()); } return(BadRequest("Contact could not deleted!")); } catch (Exception) { throw; } }
public IActionResult Delete(string id) { if (!ObjectId.TryParse(id, out var objectId)) { return(BadRequest("'Id' parameter is ivalid ObjectId")); } var oldContact = _contactManager.GetContactById(objectId); if (oldContact == null) { return(NotFound()); } _contactManager.DeleteContact(objectId); return(Ok(id)); }
// DELETE: api/Contact/5 public IHttpActionResult Delete(int id) { try { var success = _contactManager.DeleteContact(id); if (success) { return(Ok()); } else { return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Server Error"))); } } catch (Exception ex) { //Added Logger here. //Also we can handle exception in Exception Filter return(InternalServerError()); } }
public async Task <IActionResult> DeleteContact(string contactId) { await _contactMan.DeleteContact(contactId); return(Ok(new ResponseModel <object>(new object()))); }
public ActionResult DeleteContact(Guid contactPersonId) { _contactManager.DeleteContact(PersonId, contactPersonId); return(Ok()); }