コード例 #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
ファイル: ContactController.cs プロジェクト: firate/easycrm
        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));
        }
コード例 #9
0
 // 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());
 }