예제 #1
0
        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());
            }
        }
예제 #2
0
        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());
            }
        }
예제 #3
0
        public int DeleteContact(int id)
        {
            if (id > 0)
            {
                _manager.DeleteContact(id);
            }

            return(id);
        }
예제 #4
0
 public IActionResult DeleteContact(int id)
 {
     try
     {
         _contactManager.DeleteContact(id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(Util.ErrorResponse.FormatResponse("Something went wrong!", ex.Message)));
     }
 }
예제 #5
0
 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));
            }
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
        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());
     }
 }
예제 #10
0
        public async Task <IActionResult> DeleteContact(string contactId)
        {
            await _contactMan.DeleteContact(contactId);

            return(Ok(new ResponseModel <object>(new object())));
        }
예제 #11
0
 public ActionResult DeleteContact(Guid contactPersonId)
 {
     _contactManager.DeleteContact(PersonId, contactPersonId);
     return(Ok());
 }