Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "id,improvements,qualities,score,Employee_id")] selfevaluation selfevaluation, string myVar)
        {
            if (ModelState.IsValid)
            {
                MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**");
                mm.Subject    = "A new Self Evaluation is added";
                mm.Body       = "Test";
                mm.IsBodyHtml = false;
                SmtpClient smtp = new SmtpClient();
                smtp.EnableSsl = true;
                smtp.Host      = "smtp.gmail.com";
                smtp.Port      = 587;

                NetworkCredential nc = new NetworkCredential("*****@*****.**", "22012201");
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = nc;
                smtp.Send(mm);
                selfevaluation.score = Int32.Parse(myVar);
                es.Add(selfevaluation);
                es.Commit();
            }

            ViewBag.Employee_id = new SelectList(emps.GetMany(), "id", "name", selfevaluation.Employee_id);
            return(View(selfevaluation));
        }