public ActionResult SalvarNovaAta(AdicionarAtaViewModel novaAtaViewModel) { if (novaAtaViewModel.Codigo > 0) { var requisicao = new AlterarAtaEmUmaReuniaoRequisicao { CodigoDaAta = novaAtaViewModel.Codigo, Anotacoes = novaAtaViewModel.Anotacoes, Assunto = novaAtaViewModel.Assunto, CodigoDaReuniao = novaAtaViewModel.CodigoDaReuniao, CodigoDoResponsavel = novaAtaViewModel.CodigoDoResponsavel, FinalDoPrazo = novaAtaViewModel.FinalDoPrazo, InicioDoPrazo = novaAtaViewModel.InicioDoPrazo, Status = novaAtaViewModel.Status }; var resposta = _reuniaoServicoDeAplicacao.AlterarAtaEmUmaReuniao(requisicao); return Json(new { resposta.Sucesso, resposta.Erros, Ata = resposta.Ata.ToViewModel() }); } else { var requisicao = new AdicionarAtaEmUmaReuniaoRequisicao { Anotacoes = novaAtaViewModel.Anotacoes, Assunto = novaAtaViewModel.Assunto, CodigoDaReuniao = novaAtaViewModel.CodigoDaReuniao, CodigoDoResponsavel = novaAtaViewModel.CodigoDoResponsavel, FinalDoPrazo = novaAtaViewModel.FinalDoPrazo, InicioDoPrazo = novaAtaViewModel.InicioDoPrazo, Status = novaAtaViewModel.Status }; var resposta = _reuniaoServicoDeAplicacao.AdicionarAtaEmUmaReuniao(requisicao); return Json(new { resposta.Sucesso, resposta.Erros, Ata = resposta.Ata.ToViewModel() }); } }
public PartialViewResult AddEditAta(int codigoDaReuniao, int? codigoDaAta) { AdicionarAtaViewModel novaAtaViewModel; if (codigoDaAta.HasValue) { novaAtaViewModel = new AdicionarAtaViewModel { Funcionarios = _funcionarioRepositorio.ObterTodos().ToViewModel(), ListaDeStatusDaAta = typeof(StatusDaAta).ToViewModel(), CodigoDaReuniao = codigoDaReuniao, Ata = _reuniaoRepositorio.ObterAtaDaReuniao(codigoDaReuniao, codigoDaAta.Value).ToViewModel() }; } else { novaAtaViewModel = new AdicionarAtaViewModel { Funcionarios = _funcionarioRepositorio.ObterTodos().ToViewModel(), ListaDeStatusDaAta = typeof(StatusDaAta).ToViewModel(), CodigoDaReuniao = codigoDaReuniao }; } return PartialView(novaAtaViewModel); }