//[Authorize] public ActionResult FileAssociate(string fileName) { Session["currentFileProcessed"] = fileName; ViewBag.Message = "It's FileAssociate Time"; // Populate the list of Persons /* Following code works */ // nodeList = PersonDB.GetPersons(); var artifactList = PersonDB.GetPersonsNames(); int ttlNumOfNames = artifactList.Count; List <string> artifactNames = new List <string>(); artifactNames = PersonDB.GetNamesByFile(fileName); //check the box on the screen for Persons currently associated with the file int ttlNumberOfNames = artifactNames.Count; for (int i = 0; i < ttlNumberOfNames; i++) { for (int x = 0; x < ttlNumOfNames; x++) { if (artifactNames[i] == artifactList[x].Name) { artifactList[x].IfChecked = true; // check the checkbox in artifactNames list } } } return(View(artifactList)); }
public ActionResult Update([Bind(Include = "FileName,Name,ArtifactType,HeadStone,Description")] Artifact artifact) { ViewBag.Message = "It's Update Time"; List <string> artifactNames = new List <string>(); artifactNames = PersonDB.GetNamesByFile(artifact.FileName); foreach (string name in artifactNames) { if (ModelState.IsValid) { var genericArtifactRow = db.Artifact.Find(artifact.FileName, name); genericArtifactRow.Description = artifact.Description; db.Entry(genericArtifactRow).State = EntityState.Modified; db.SaveChanges(); } } TempData["ReturnData"] = "Photo was successfully updated"; return(RedirectToAction("Index")); //return View(artifact); }