コード例 #1
0
ファイル: AnuncioController.cs プロジェクト: Hauffe/PLX
        public async Task <ActionResult> BuscarPorId(int id)
        {
            using (ServiceAnuncioClient anuncio = new ServiceAnuncio.ServiceAnuncioClient())
            {
                var ret = await anuncio.buscarPorIdAsync(id);

                return(View(AutoMapper.Mapper.Map <AnuncioVM>(ret)));
            }
        }
コード例 #2
0
ファイル: AnuncioController.cs プロジェクト: Hauffe/PLX
        public async Task <ActionResult> ListarTodos()
        {
            using (ServiceAnuncioClient anuncio = new ServiceAnuncio.ServiceAnuncioClient())
            {
                var ret = await anuncio.ListarTodosAsync();

                return(View(AutoMapper.Mapper.Map <AnuncioVM[]>(ret)));
            }
        }
コード例 #3
0
ファイル: AnuncioController.cs プロジェクト: Hauffe/PLX
        public ActionResult NovoAnuncio(string Descricao, string titulo, double preco, int idUsuario, int idCategoria)
        {
            try
            {
                using (ServiceAnuncioClient anuncio = new ServiceAnuncio.ServiceAnuncioClient())
                {
                    anuncio.SalvarAnuncioAsync(idUsuario, idCategoria, Descricao, titulo, preco);
                    ViewBag.Message = "Cadastrado com sucesso ";
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }