コード例 #1
0
ファイル: CMMaintController.cs プロジェクト: mj9119/BomanGen
        //[Authorize]
        //[ValidateAntiForgeryToken]
        //public ActionResult FileAssociate([Bind(Include = "FileName,Name,ArtifactType,HeadStone,Description")]Artifact artifact)
        public ActionResult FileAssociate(List <BomanGen.Models.ArtifactModel> list)
        {
            ViewBag.Message = "It's Test 1 2 3 Time";
            string currFileName = Session["currentFileProcessed"].ToString();

            // Retrieve and temporarily hold the generic row in an Artifact Model class
            var genericArtifactRow = db.Artifact.Find(currFileName, genericPersonName);

            // Delete all database rows for this fileName
            // in case the user de-selected any of them
            if (PersonDB.DelNamesByFile(currFileName) == true)
            {
                ;
            }

            // Re-Add the Generic Person database row since it has to exist
            PersonDB.AddNameToArtifacts(genericArtifactRow);

            /* bool trueOrFalse = PersonDB.DelNamesByFile(currFileName); */

            int ttlNumOfNames = list.Count;

            for (int x = 0; x < ttlNumOfNames; x++)
            {
                if (list[x].IfChecked == true)
                {
                    Artifact currArtifact = new Artifact();
                    //var myRow = db.Artifact.ToArray();
                    //var genericRow = db.Artifact.Find(currFileName);
                    currArtifact.FileName     = currFileName;
                    currArtifact.Name         = list[x].Name;
                    currArtifact.HeadStone    = genericArtifactRow.HeadStone;
                    currArtifact.Description  = genericArtifactRow.Description;
                    currArtifact.ArtifactType = genericArtifactRow.ArtifactType;
                    //BomanGen.Models.Artifact currArtifact;
                    PersonDB.AddNameToArtifacts(currArtifact);
                }
            }

            TempData["ReturnData"] = "The following Artifact or Photo was Updated successfully: " + currFileName;
            return(View(list));
        }