示例#1
0
        /// <summary>
        /// Updates the entity model with the changes, but does not save.
        /// </summary>
        /// <param name="publicVM">The publicVm instance</param>
        /// <param name="db">the database</param>
        /// <returns>(make use of this)</returns>
        public bool UpdateChanges(PublicVM publicVM, WASEntities db)
        {
            tbl_Document modDoc = SelectById(publicVM.Document_ID.ToString(), true);

            //maybe more elegant way to do this
            modDoc.Issue_DT    = publicVM.IssueDate;
            modDoc.Description = publicVM.Description;
            modDoc.Method      = publicVM.Method;
            modDoc.Originator  = publicVM.Originator;
            modDoc.Reason      = publicVM.Reason;
            modDoc.Recipient   = publicVM.Recipient;
            modDoc.Active_IND  = publicVM.Hidden;

            db.Entry(modDoc).State = System.Data.Entity.EntityState.Modified; //tags the row as one thats modifed and needs to be saved

            //should probably do some conditional check here to allow user to know if it actually got modified
            return(true);
        }
示例#2
0
        public ActionResult Edit([Bind(Prefix = "publicId")] string Folder_ID, List <PublicVM> updatedEditList)
        {
            if (ModelState.IsValid)
            {
                foreach (PublicVM pvm in updatedEditList)
                {
                    tbl_Document modDoc = documentRepository.SelectById(pvm.Document_ID.ToString(), true);
                    modDoc.Issue_DT    = pvm.IssueDate;
                    modDoc.Description = pvm.Description;
                    modDoc.Method      = pvm.Method;
                    modDoc.Originator  = pvm.Originator;
                    modDoc.Reason      = pvm.Reason;
                    modDoc.Recipient   = pvm.Recipient;
                    modDoc.Active_IND  = pvm.Hidden;

                    _db.Entry(modDoc).State = System.Data.Entity.EntityState.Modified;
                }
                _db.SaveChanges();
            }

            return(RedirectToAction("Index", "Folder", new { ClientId = TempData["Client_Id"], Role = "Admin" }));
        }
 public void Update(tbl_Document doc)
 {
     _db.Entry(doc).State = System.Data.Entity.EntityState.Modified;
 }