Esempio n. 1
0
        // This is the post request with forms data that will be bind the action, if in the data post request have enough information to build a Student instance that will be bind
        public ActionResult AddProduct(MpiHeader_Test product)
        {
            //var product = new MpiHeader_Test()
            //{
            //    NAME = "ManualName",
            //    CODE = "ManualCode"
            //};
            try
            {
                //Gets a value that indicates whether this instance received from the view is valid.
                if (ModelState.IsValid)
                {
                    var db = MpiConn._db;
                    // Adds to the context
                    db.Insert(product);
                    // Persist the data

                    // Returns an HTTP 302 response to the browser, which causes the browser to make a GET request to the specified action, in this case the index action.
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            // view = default in this case Create and model = student
            return(View(product));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(string id)
        {
            MpiHeader_Test mpiHeader_Test = db.MpiHeader_Test.Find(id);

            db.MpiHeader_Test.Remove(mpiHeader_Test);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "CODE,AssetClassId,NAME,PROVIDER,HCAUNIVERSE,TICKER,CUSIP,MINIMUM,GROSSNET,EXPENSERATIO,PORTDATE,ASSETCLASS,OPENCLOSED,MGRBENCHMARK,HCABENCHMARK,ASSETS,AlternateMappingID,MapReturns,MapReturnsBeforeOrAfter,InceptionDate,FootNote,IsIndex,SubType,PrimaryBMID,StylusTemplate,ACID,StylusUnvID,StylusFundID")] MpiHeader_Test mpiHeader_Test)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mpiHeader_Test).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mpiHeader_Test));
 }
Esempio n. 4
0
        // GET: TestA/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MpiHeader_Test mpiHeader_Test = db.MpiHeader_Test.Find(id);

            if (mpiHeader_Test == null)
            {
                return(HttpNotFound());
            }
            return(View(mpiHeader_Test));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "CODE,AssetClassId,NAME,PROVIDER,HCAUNIVERSE,TICKER,CUSIP,MINIMUM,GROSSNET,EXPENSERATIO,PORTDATE,ASSETCLASS,OPENCLOSED,MGRBENCHMARK,HCABENCHMARK,ASSETS,AlternateMappingID,MapReturns,MapReturnsBeforeOrAfter,InceptionDate,FootNote,IsIndex,SubType,PrimaryBMID,StylusTemplate,ACID,StylusUnvID,StylusFundID")] MpiHeader_Test mpiHeader_Test)
        {
            var connection = Models.MpiConn._db;

            if (ModelState.IsValid)
            {
                string code = "Test123";
                string name = "abc";
                connection.Execute("insert [Mpiheader_Test](code, name) values(@code, @name)",
                                   new { code, name });
            }

            return(View());
        }