public Restaurante Delete(DeletarRestauranteComando command)
        {
            var restaurante = _repository.GetOne(command.Nome);

            _repository.Delete(restaurante);

            if (Commit())
            {
                return(restaurante);
            }

            return(null);
        }
        public Task <HttpResponseMessage> delete(string nome) // Deleta o restaurante
        {
            var response = new HttpResponseMessage();

            try
            {
                var command = new DeletarRestauranteComando(nome);

                var restaurante = _service.Delete(command);

                response = Request.CreateResponse(HttpStatusCode.OK, "Apagado com sucesso!");
            }
            catch
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest, "Restaurante não encontrado!");
            }
            var tsc = new TaskCompletionSource <HttpResponseMessage>();

            tsc.SetResult(response);
            return(tsc.Task);
        }