Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AcctReport acctReport = db.AcctReports.Find(id);

            db.AcctReports.Remove(acctReport);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        // GET: Directories/AcctReportsTest/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AcctReport acctReport = db.AcctReports.Find(id);

            if (acctReport == null)
            {
                return(HttpNotFound());
            }
            return(View(acctReport));
        }
Esempio n. 3
0
        // GET: Directories/AcctReportsTest/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AcctReport acctReport = db.AcctReports.Find(id);

            if (acctReport == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClientTypes = db.ClientTypes.ToList();

            return(View(acctReport));
        }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "Id,Acc2,Resident,CntrPartner")] AcctReport acctReport, int[] selectedClientTypes)
        {
            if (ModelState.IsValid)
            {
                if (selectedClientTypes != null)
                {
                    foreach (var c in db.ClientTypes.Where(co => selectedClientTypes.Contains(co.Id)))
                    {
                        acctReport.ClientTypes.Add(c);
                    }
                }
                db.AcctReports.Add(acctReport);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(acctReport));
        }
Esempio n. 5
0
        public ActionResult Edit([Bind(Include = "Id,Acc2,Resident,CntrPartner, selectedClientTypes")] AcctReport acctReport, int[] selectedClientTypes)
        {
            if (ModelState.IsValid)
            {
                AcctReport acctReportUpdated = db.AcctReports.Find(acctReport.Id);
                UpdateModel(acctReportUpdated);

                acctReportUpdated.ClientTypes.Clear();

                if (selectedClientTypes != null)
                {
                    foreach (var c in db.ClientTypes.Where(co => selectedClientTypes.Contains(co.Id)))
                    {
                        acctReportUpdated.ClientTypes.Add(c);
                    }
                }
                db.Entry(acctReportUpdated).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(acctReport));
        }