public static void RunMigration( )
        {
            var mg = new m1();

            //mg.Up();

            mg.Down();

            var context = new ModelNW3();

            var prop = mg.GetType().GetProperty("Operations", BindingFlags.NonPublic | BindingFlags.Instance);

            if (prop != null)
            {
                IEnumerable <MigrationOperation> operations = prop.GetValue(mg) as IEnumerable <MigrationOperation>;

                var generator  = new SqlServerMigrationSqlGenerator();
                var statements = generator.Generate(operations, "2008");

                try
                {
                    foreach (MigrationStatement item in statements)
                    {
                        context.Database.ExecuteSqlCommand(item.Sql);
                    }
                }
                catch (Exception ex)
                {
                    //does not exist in table - 4924
                    //Column names in each table must be unique - 2705
                    var ss = ex.Message;
                    return;
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            m1 m1 = db.m1.Find(id);

            db.m1.Remove(m1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "m1Id,nazwa,adres")] m1 m1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(m1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(m1));
 }
        public ActionResult Create([Bind(Include = "m1Id,nazwa,adres")] m1 m1)
        {
            if (ModelState.IsValid)
            {
                db.m1.Add(m1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(m1));
        }
        // GET: m1/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            m1 m1 = db.m1.Find(id);

            if (m1 == null)
            {
                return(HttpNotFound());
            }
            return(View(m1));
        }
Example #6
0
        static void Main(string[] args)
        {
            Mydelegate obj = (a) =>      //statement lambda
            {
                a += 5;
                Console.WriteLine(a);
            };

            obj(10);

            m1 o = (a) => a += 5;   //expression lambda

            Console.WriteLine(o.Invoke(10));

            cal c = (a, b) => a + b;

            Console.WriteLine(c(10, 17));
        }
 m2 * Integration.ComputeIndefiniteIntegral(m1, x) :
 null,