public void CadastrarCategoria() { CategoriaDto contaDeTelefone = new CategoriaDto() { Nome = "Conta do Telefone Celular" }; categoriaAplicacao.Cadastrar(contaDeTelefone); Assert.IsTrue(true); }
public JsonResult CadastrarCategoria(CategoriaCadastroModel model) { if (model == null || String.IsNullOrEmpty(model.Nome)) { return Json(new { successo = false, textoDeResposta = "Objet não pode ser vazio" }, JsonRequestBehavior.AllowGet); } try { CategoriaDto dto = new CategoriaDto() { Nome = model.Nome }; app.Cadastrar(dto); return Json(new { successo = true, textoDeResposta = String.Format("Categoria {0} cadstrada com sucesso!", dto.Nome) }, JsonRequestBehavior.AllowGet); }catch(Exception ex){ return Json(new { successo = false, textoDeResposta = String.Format("Erro ao cadastrar categoria {0}", ex.Message) }, JsonRequestBehavior.AllowGet); } }
public static void Monta(Categoria origem, CategoriaDto destino) { FisiologiaDaClasse.GeraReplica(typeof(Categoria), origem, typeof(CategoriaDto), destino); }