コード例 #1
0
        public IHttpActionResult Delete(string userName)
        {
            log.Debug("Call to ExternalAccountController.Delete");

            if (string.IsNullOrWhiteSpace(userName))
            {
                return(BadRequest("Can not delete user, username missing"));
            }

            SipAccount user = _sipAccountManager.GetByUserName(userName);

            if (user == null)
            {
                log.Error("Could not delete user because it's missing");
                return(NotFound());
            }

            try
            {
                if (!_sipAccountManager.Delete(user.Id))
                {
                    return(InternalServerError(new ApplicationException("User not deleted")));
                }
                return(Ok("User deleted"));
            }
            catch (Exception ex)
            {
                log.Error(ex, "Could not delete user");
                return(InternalServerError(new ApplicationException("User could not be deleted. " + ex.Message)));
            }
        }
コード例 #2
0
 public ActionResult Delete(DeleteSipAccountViewModel model)
 {
     _sipAccountManager.Delete(Guid.Parse(model.Id));
     return(RedirectToAction("Index"));
 }