コード例 #1
0
            public void SalvarFavorito()
            {
                var sut        = new ServicoDeRepositorio();
                var formulario = new FormularioDeRepositorios()
                {
                    ID = "52880443", Name = "angular-base64-upload", Description = "Converts files from file input into base64 encoded models", Html_url = "https://github.com/tiago-system13/angular-base64-upload", Language = "JavaScript", Updated_at = Convert.ToDateTime("01/03/2016 10:54:26"), Login = null
                };

                sut.SalvarFavorito(formulario);
                //  Assert.That(sut.lista, !Is.Empty);
            }
コード例 #2
0
        public ActionResult Cadastrar(FormularioDeRepositorios formularioRepositorio)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _servRepositorio.SalvarFavorito(formularioRepositorio);
                    return(Json(new { Sucesso = true, mensagem = "Repositório marcado com sucesso!" }, JsonRequestBehavior.AllowGet));
                }
                catch (ArgumentException ex)
                {
                    return(Json(new { Sucesso = false, mensagem = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }

            return(View("IndexRepositorio"));
        }