private void UpdateDivulgacoes(AnuncioModel divulgacao) { var index = AnunciosDisponiveis.IndexOf(divulgacao); AnunciosDisponiveis.Remove(divulgacao); AnunciosDisponiveis.Insert(index, divulgacao); }
public ActionResult Delete(int id) { Anuncio anuncio = _anuncioService.Buscar(id); AnuncioModel anuncioModel = _mapper.Map <AnuncioModel>(anuncio); return(View(anuncioModel)); }
internal virtual void HideOrShowAgendamento(AnuncioModel divulgacao) { if (divulgacao == null) { return; } if (_oldDivulgacao == divulgacao) { //click twice on the same item will hide it divulgacao.ESelecionado = !divulgacao.ESelecionado; UpdateDivulgacoes(divulgacao); } else { if (_oldDivulgacao != null) { // hide previous selected item _oldDivulgacao.ESelecionado = false; UpdateDivulgacoes(_oldDivulgacao); } // show selected item divulgacao.ESelecionado = true; UpdateDivulgacoes(divulgacao); } _oldDivulgacao = divulgacao; }
public ActionResult Edit(int id, AnuncioModel anuncioModel) { if (ModelState.IsValid) { var anuncio = _mapper.Map <Anuncio>(anuncioModel); _anuncioService.Alterar(anuncio); } return(RedirectToAction(nameof(Index))); }
public ActionResult Create(AnuncioModel anuncioModel) { if (ModelState.IsValid) { var anuncio = _mapper.Map <Anuncio>(anuncioModel); anuncio.Data = DateTime.Now; _anuncioService.Inserir(anuncio); } return(RedirectToAction(nameof(Index))); }
private void ReservarCommand() { _AnuncioSelecionado = ItemSelecionado; if (_AnuncioSelecionado == null) { this._MessageService.ShowAsync("Não á nenhum anuncio selecionado!"); } else { this._NavigationService.NavigateToSelectDates(); } }
public ActionResult Edit(int id) { Anuncio anuncio = _anuncioService.Buscar(id); AnuncioModel anuncioModel = _mapper.Map <AnuncioModel>(anuncio); IEnumerable <Imovel> listarImoveis = _imovelService.ObterTodos(); IEnumerable <Pessoa> listarPessoas = _pessoaService.ObterTodos(); ViewBag.IdImovel = new SelectList(listarImoveis, "CodigoImovel", "Descricao", null); ViewBag.IdPessoa = new SelectList(listarPessoas, "CodigoPessoa", "Nome", null); return(View(anuncioModel)); }
public void DeleteTest_Post() { // Act var result = controller.Delete(1); // Assert Assert.IsInstanceOfType(result, typeof(ViewResult)); ViewResult viewResult = (ViewResult)result; Assert.IsInstanceOfType(viewResult.ViewData.Model, typeof(AnuncioModel)); AnuncioModel anuncioModel = (AnuncioModel)viewResult.ViewData.Model; Assert.AreEqual("TESTE 3", anuncioModel.Descricao); Assert.AreEqual(1, anuncioModel.CodigoImovel); Assert.AreEqual(1, anuncioModel.CodigoPessoa); }
public void Default(IncluirAnuncioOutput incluirAnuncioOutput) { var anuncio = new AnuncioModel { ID = incluirAnuncioOutput.Anuncio.ID, Marca = incluirAnuncioOutput.Anuncio.Marca, Modelo = incluirAnuncioOutput.Anuncio.Modelo, Versao = incluirAnuncioOutput.Anuncio.Versao, Ano = incluirAnuncioOutput.Anuncio.Ano, Quilometragem = incluirAnuncioOutput.Anuncio.Quilometragem, Observacao = incluirAnuncioOutput.Anuncio.Observacao }; var incluirAnuncioResponse = new IncluirAnuncioResponse(anuncio); ViewModel = new OkObjectResult(incluirAnuncioResponse); }
public void Default(ConsultarAnuncioOutput consultarAnuncioOutput) { var anuncio = new AnuncioModel { ID = consultarAnuncioOutput.Anuncio.ID, Marca = consultarAnuncioOutput.Anuncio.Marca, Modelo = consultarAnuncioOutput.Anuncio.Modelo, Versao = consultarAnuncioOutput.Anuncio.Versao, Ano = consultarAnuncioOutput.Anuncio.Ano, Quilometragem = consultarAnuncioOutput.Anuncio.Quilometragem, Observacao = consultarAnuncioOutput.Anuncio.Observacao }; var consultarAnuncioResponse = new ConsultarAnuncioResponse(anuncio); ViewModel = new OkObjectResult(consultarAnuncioResponse); }
public ActionResult EditAnuncio(AnuncioModel anuncio) { try { if (ModelState.IsValid) { _anuncioApplication.EditAnuncio(anuncio); } else { return(View(anuncio)); } return(RedirectToAction("index")); } catch (Exception e) { return(View()); } }
public bool EditAnuncio(AnuncioModel anuncio) { return(_anuncioService.Update(TransformObject.ModelEntity <Anuncio>(anuncio))); }
public ConsultarAnuncioResponse(AnuncioModel anuncioModel) { AnuncioModel = anuncioModel; }
public AtualizarAnuncioResponse(AnuncioModel anuncioModel) { AnuncioModel = anuncioModel; }
public IncluirAnuncioResponse(AnuncioModel incluirAnuncioModel) { IncluirAnuncioModel = incluirAnuncioModel; }
public ActionResult Delete(int id, AnuncioModel anuncioModel) { _anuncioService.Excluir(id); return(RedirectToAction(nameof(Index))); }
public bool CreateAnuncio(AnuncioModel anuncio) { return(_anuncioService.Add(TransformObject.ModelEntity <Anuncio>(anuncio))); }