public ActionResult Edit(int id, Ressource R, HttpPostedFileBase upload) { try { if (upload != null) { string path = Path.Combine(Server.MapPath("~/Content/Upload"), upload.FileName); upload.SaveAs(path); R.PictureURL = upload.FileName; } Domain.Entity.Ressource ress = serviceRessource.GetById(id); ress.LastName = R.LastName; ress.FirstName = R.FirstName; ress.ContractType = R.ContractType; ress.Seniority = R.Seniority; ress.PictureURL = R.PictureURL; ress.SkillSet = R.SkillSet; ress.Notes = R.Notes; ress.Resume = R.Resume; ress.state = R.state; ress.OrganizationalId = R.OrganizationalId; serviceRessource.Update(ress); serviceRessource.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }
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)); } }