Esempio n. 1
0
        public ActionResult Perfil(int id)
        {
            var ViewModel = new ViewModelPerfil();

            ViewModel.Usuario = UsuariosDAO.Carregar(id);

            TarefasDAO TarefasDAO = new TarefasDAO(ConfigurationManager.ConnectionStrings["strConMain"].ConnectionString);

            //Busca as tarefa com status finalizada
            ViewModel.ListFinalizadas = TarefasDAO.ListarTop(ConfigurationManager.AppSettings["Finalizada"], 0, 5);

            ViewModel.TarefasMes = new List <int>();

            for (int i = 1; i <= 12; i++)
            {
                ViewModel.TarefasMes.Add(TarefasDAO.QuantidadeTarefasMes(i));
            }

            CompetenciasDAO CompetenciasDAO = new CompetenciasDAO(ConfigurationManager.ConnectionStrings["strConMain"].ConnectionString);

            ViewModel.ListCompetencias = CompetenciasDAO.Listar();

            foreach (var item in ViewModel.ListCompetencias)
            {
                item.Pontos = CompetenciasDAO.CompetenciaPontos(item.ID);
            }

            return(View(ViewModel));
        }
Esempio n. 2
0
        public ActionResult Add(ViewModelPerfil perfil)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new { success = false, Errors = GetErrorsFromModelState(ModelState), JsonRequestBehavior.AllowGet }));
            }
            Perfil p = new Perfil();

            p.Extracto    = perfil.Extracto;
            p.Titular     = perfil.Titular;
            p.ImgExtracto = SaveUploadedFile(perfil.imgExtracto);
            p.ImgTitular  = SaveUploadedFile(perfil.imgTitular);
            Entities.Perfil.Add(p);
            Entities.SaveChanges();
            return(Json(new { success = true, Errors = GetErrorsFromModelState(ModelState), JsonRequestBehavior.AllowGet }));
        }