Exemplo n.º 1
0
        public ActionResult Edit(int id, ResourceModel pm)
        {
            try
            {
                // TODO: Add update logic here
                Ressource p1 = rs.GetById(id);
                p1.Name      = pm.Name;
                p1.ProfileT  = pm.ProfileT;
                p1.Seniority = pm.Seniority;
                p1.Email     = pm.Email;
                //p1.ProjectPicture = pm.ProjectPicture;
                rs.Update(p1);
                rs.Commit();

                /*
                 * MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**", "compte modifié cree ", " your Account is updated ");
                 * SmtpClient client = new SmtpClient("Smtp.gmail.com");
                 * client.Port = 25;
                 * client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "OMAR.DAGDOUG.1407");
                 * client.EnableSsl = true;
                 * client.Send(mail);
                 *
                 */
                return(RedirectToAction("Index2"));
            }
            catch (Exception ex)
            {
                return(View(pm));
            }
        }
Exemplo n.º 2
0
        public ActionResult Create(HttpPostedFileBase ImageId, /*[Bind(Include = "RessourceID,ContractType,Seniority,SkillSet,Notes,Resume,PictureURL,state")]*/ Ressource ressource)
        {
            /*  if (!ModelState.IsValid || ImageId == null || ImageId.ContentLength == 0)
             * {
             *    RedirectToAction("Create");
             * }
             * ressource.PictureURL = ImageId.FileName;
             * TempData["Image"] = ImageId;
             * Session["Ressource"] = ressource;
             *
             * //  db.Ressources.Add(ressource);
             * db.SaveChanges();
             *
             *
             *  var image = TempData["Image"] as HttpPostedFileBase;
             *
             * var path = Path.Combine(Server.MapPath("~/Content/Upload/"), image.FileName);
             *  image.SaveAs(path);
             * return RedirectToAction("Index");*/


            // Ressource R = new Ressource();

            Domain.Entity.Ressource ress = new Domain.Entity.Ressource();
            ress.LastName         = ressource.LastName;
            ress.FirstName        = ressource.FirstName;
            ress.ContractType     = ressource.ContractType;
            ress.Seniority        = ressource.Seniority;
            ress.PictureURL       = ressource.PictureURL;
            ress.SkillSet         = ressource.SkillSet;
            ress.Notes            = ressource.Notes;
            ress.Resume           = ressource.Resume;
            ress.state            = ressource.state;
            ress.StartHoliday     = ressource.StartHoliday;
            ress.EndHoliday       = ressource.EndHoliday;
            ress.OrganizationalId = ressource.OrganizationalId;
            serviceRessource.Add(ress);
            serviceRessource.Commit();
            if (!ModelState.IsValid || ImageId == null || ImageId.ContentLength == 0)
            {
                RedirectToAction("Create");
            }
            ressource.PictureURL = ImageId.FileName;
            TempData["Image"]    = ImageId;
            var path = Path.Combine(Server.MapPath("~/Content/Upload/"), ImageId.FileName);

            ImageId.SaveAs(path);
            return(RedirectToAction("Index"));
        }