public ActionResult Create(int DocumentIdValue, List <int> Parties)
        {
            ViewBag.Current = "Forms";

            if (Parties == null)
            {
                return(RedirectToAction("Index", new { @id = DocumentIdValue, @msg = "CreateError" }));
            }
            if (ModelState.IsValid)
            {
                foreach (int i in Parties)
                {
                    var DocumentParty = new DocumentParty()
                    {
                        PartyId     = i,
                        DocumentId  = DocumentIdValue,
                        CreatedAt   = DateTime.Now.ToString("dd/MM/yyyy-HH:mm:ss"),
                        CreatedById = this.User.Identity.GetUserId()
                    };

                    db.DocumentParties.Add(DocumentParty);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index", new { @id = DocumentIdValue, @msg = "CreateSuccess" }));
            }

            return(RedirectToAction("Index", new { @id = DocumentIdValue }));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DocumentParty DocumentParty = db.DocumentParties.Find(id);

            db.DocumentParties.Remove(DocumentParty);
            int Document_Id = DocumentParty.DocumentId;

            db.SaveChanges();
            return(RedirectToAction("Index", new { @id = Document_Id, @msg = "DeleteSuccess" }));
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            DocumentParty DocumentParty = db.DocumentParties.Include(a => a.Document).Include(a => a.CreatedBy).Include(a => a.Party).SingleOrDefault(a => a.Id == id);

            if (DocumentParty == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }
            return(View(DocumentParty));
        }
Esempio n. 4
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("BadRequestError", "ErrorController"));
            }
            DocumentParty DocumentParty = db.DocumentParties.Include(a => a.Document).Include(a => a.CreatedBy).Include(a => a.Party).SingleOrDefault(a => a.Id == id);

            if (DocumentParty == null)
            {
                return(RedirectToAction("HttpNotFoundError", "ErrorController"));
            }

            if (ManagedAes.CipherData)
            {
                DocumentParty.Document.Subject = ManagedAes.DecryptText(DocumentParty.Document.Subject);
            }
            return(View(DocumentParty));
        }