Ejemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "ID,ErrorNo,ErrorType,Precautions,Deadline,Person")] DFiveTable dFiveTable)
        {
            var userModel = common.getCurrentUserModel();

            dFiveTable.Company = userModel.Company;
            if (ModelState.IsValid)
            {
                db.Entry(dFiveTable).State = EntityState.Modified;


                try
                {
                    db.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    ViewBag.Person = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name");// text , value
                    createDropDownForErrorType();
                    return(View(dFiveTable));
                }

                return(RedirectToAction("DSteps", "EightStep", new { errorNo = dFiveTable.ErrorNo }));
            }
            //ViewBag.ErrorNo = new SelectList(db.ErrorListTable, "ErrorNo", "Company", dFiveTable.ErrorNo);
            ViewBag.Person = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name"); // text , value
            // dropdown için errortype seçimi listesi gelicek
            createDropDownForErrorType();


            return(View(dFiveTable));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            DFiveTable dFiveTable = db.DFiveTable.Find(id);

            db.DFiveTable.Remove(dFiveTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        // GET: DFiveTables/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DFiveTable dFiveTable = db.DFiveTable.Find(id);

            if (dFiveTable == null)
            {
                return(HttpNotFound());
            }
            return(View(dFiveTable));
        }
Ejemplo n.º 4
0
        // GET: DFiveTables/Edit/5
        public ActionResult Edit(int?id)
        {
            var userModel = common.getCurrentUserModel();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DFiveTable dFiveTable = db.DFiveTable.Find(id);

            if (dFiveTable == null)
            {
                return(HttpNotFound());
            }
            // ViewBag.ErrorNo = new SelectList(db.ErrorListTable, "ErrorNo", "Company", dFiveTable.ErrorNo);
            ViewBag.Person = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name"); // text , value
            // dropdown için errortype seçimi listesi gelicek
            createDropDownForErrorType();

            return(View(dFiveTable));
        }
Ejemplo n.º 5
0
        public ActionResult Create(HttpPostedFileBase[] imageFiles, HttpPostedFileBase[] documentFiles, [Bind(Include = "ID,ErrorType,Precautions,Deadline,Person")] DFiveTable dFiveTable)
        {
            var userModel = common.getCurrentUserModel();
            var errorNo   = common.getCurrentErrorNo();

            dFiveTable.ErrorNo = errorNo;
            dFiveTable.Company = userModel.Company;


            if (ModelState.IsValid)
            {
                db.DFiveTable.Add(dFiveTable);
                try
                {
                    db.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    ViewBag.Person = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name");// text , value
                    createDropDownForErrorType();
                    return(View(dFiveTable));
                }


                // save images on ImgesTable
                fileHelper.saveImagesDB(imageFiles, "D5", errorNo);
                // save document on NotesTable
                fileHelper.saveDocumentDB(documentFiles, "D5", errorNo);

                return(RedirectToAction("DSteps", "EightStep", new { errorNo = dFiveTable.ErrorNo }));
            }

            //ViewBag.ErrorNo = new SelectList(db.ErrorListTable, "ErrorNo", "Company", dFiveTable.ErrorNo);
            ViewBag.Person = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name"); // text , value
            // dropdown için errortype seçimi listesi gelicek
            createDropDownForErrorType();
            return(View(dFiveTable));
        }