public ActionResult Edit([Bind(Include = "Id,Position,NumberOfPersons,Team,Head,TypeOfPayment,Amount,CurrencyType,PaymentComments,EmploymentType,CauseOfOccurrence,Duties,GoalsAndObjectives,Gender,YearsOld,FamilyStatus,Location,Education,WorkExperience,ProfessionalKnowledge,PersonalQualities,AdditionalRequirements,TechnicalInterviewsAreConducted,TheFinalDecision,ExpectedDateOfEmployment")] Vacancies vacancies) { if (ModelState.IsValid) { db.Entry(vacancies).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vacancies)); }
public ActionResult Edit([Bind(Include = "Id,Email,Password,CreationDate,RoleId")] User user) { var db = new SwanDbEntities(); if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ShowAllUsers", "Account")); } ViewBag.RoleId = new SelectList(db.Roles, "Id", "Name", user.RoleId); return(View(user)); }
public ActionResult Edit(Candidate candidate, HttpPostedFileBase image = null, HttpPostedFileBase file = null) { if (ModelState.IsValid) { if (image != null) { candidate.PhotoMimeType = image.ContentType; candidate.Photo = new byte[image.ContentLength]; image.InputStream.Read(candidate.Photo, 0, image.ContentLength); } if (file != null) { candidate.AttachmentsMimeType = file.ContentType; candidate.Attachments = new byte[file.ContentLength]; file.InputStream.Read(candidate.Attachments, 0, file.ContentLength); } if (candidate.CandidateId == 0) { _db.Candidate.Add(candidate); } else { var entry = _db.Entry(candidate); entry.State = EntityState.Modified; if (image == null) { entry.Property(e => e.Photo).IsModified = false; entry.Property(e => e.PhotoMimeType).IsModified = false; } if (file == null) { entry.Property(e => e.Attachments).IsModified = false; entry.Property(e => e.AttachmentsMimeType).IsModified = false; } } candidate.WhoIntroduced = _db.Users.First(u => u.Email == HttpContext.User.Identity.Name).Id; _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Vacancy = new SelectList(_db.Vacancies, "Id", "Position", candidate.Vacancy); return(View("Edit", candidate)); }