public async Task <IActionResult> Edit(int id, [Bind("LaceID,Colour,Print,Brand,Length,ImageURL,Description")] Lace lace) { if (id != lace.LaceID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lace); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LaceExists(lace.LaceID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lace)); }
public static void TestSingleThread() { SylvanSharp.Lace.Init(0, 100000); SylvanSharp.SylvanSharp.init(22, 22, 22, 22, 1); var t = bdd.bddtrue; var f = bdd.bddfalse; var a = bdd.ithvar(0); var b = bdd.ithvar(1); var a_and_b = a.And(b); var a_and_not_b = a.And(b.Not()); a_and_not_b.PrintDot(); Assert(!a_and_b.EqualEqual(t)); Assert(a_and_b.And(a_and_not_b).EqualEqual(f)); //bdd zero_to_hundred = PeformTreeAnd(0, 3); //SylvanSharpPInvoke.print_dot(zero_to_hundred.Id); var array = new bdd[100]; Lace.ParallelFor((i) => { array[i] = bdd.ithvar(i).And(bdd.ithvar(i + 1)); }, array.Length); int x = 0; Lace.ParallelFor((i) => { Console.WriteLine("{0} {0}", i, array[i]); Lace.LockRegion(mutex, () => { Console.WriteLine(i); x += i; }); }, array.Length); Console.WriteLine("Acc x = {0}", x); SylvanSharp.SylvanSharp.quit(); Lace.Exit(); }
public async Task <IActionResult> Create([Bind("LaceID,Colour,Print,Brand,Length,ImageURL,Description")] Lace lace) { if (ModelState.IsValid) { _context.Add(lace); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(lace)); }
//Seed data by Conor private static void InitialiseLaces(ApplicationDbContext context) { if (context.Lace.Any()) { return; } var laces = new Lace[] { new Lace { Colour = Colours.Black, Print = "Blue Lace", Brand = Brands.Nike, Length = 10, Price = 3.35m, ImageURL = "Redshoe.jpg", Description = "One of the best" }, new Lace { Colour = Colours.Green, Brand = Brands.UnderArmour, Length = 20, Price = 2.10m, ImageURL = "Ben10.jpg" }, new Lace { Colour = Colours.Pink, Brand = Brands.Fila, Length = 10, Price = 4.99m, ImageURL = "RedAgain.jpg", Description = "A great lace" }, new Lace { Colour = Colours.Yellow, Brand = Brands.Adidas, Length = 15, Price = 4.50m, ImageURL = "Print.jpg", Description = "One of a kind" }, new Lace { Colour = Colours.Green, Brand = Brands.UnderArmour, Length = 19, Price = 1.80m, ImageURL = "Metal.jpg", Description = "Simply the best" }, new Lace { Colour = Colours.Black, Brand = Brands.Lacoste, Length = 12, Price = 2.25m, ImageURL = "LovelyLaces.jpg", Description = "Sporty and colourful" }, new Lace { Colour = Colours.Cyan, Brand = Brands.Puma, Length = 15, Price = 2.50m, ImageURL = "Hipster.jpg", Description = "On the older range of laces but the quality still holds up today" }, new Lace { Colour = Colours.Red, Brand = Brands.Champion, Length = 11, Price = 3.45m, ImageURL = "GreyShoe.jpg", Description = "Made for Champions" }, new Lace { Colour = Colours.Green, Print = "Who Dat Boi", Brand = Brands.Ellesse, Length = 22, Price = 0.99m, ImageURL = "greenish.jpg", Description = "Who him is?" }, new Lace { Colour = Colours.Pink, Print = "Happy Birthday", Brand = Brands.Adidas, Length = 10, Price = 1.99m, ImageURL = "GenericLace.jpg", Description = "A quality durable lace" }, new Lace { Colour = Colours.Blue, Brand = Brands.Champion, Length = 16, Price = 2.99m, ImageURL = "DisShoe.jpg", Description = "A new and exciting pink lace" }, new Lace { Colour = Colours.Purple, Print = "Hello", Brand = Brands.Kappa, Length = 14, Price = 2.00m, ImageURL = "DatShoe.jpg", Description = " Affordable and stylish" }, new Lace { Colour = Colours.White, Brand = Brands.Reebok, Length = 10, Price = 2.80m, ImageURL = "darkgreenish.jpg", Description = "A Classic!!!" }, new Lace { Colour = Colours.Grey, Brand = Brands.Fila, Length = 11, Price = 1.00m, ImageURL = "DarkColours.jpg", Description = "A colourful lace for any shoe" }, new Lace { Colour = Colours.Pink, Print = "Kick it", Brand = Brands.Nike, Length = 14, Price = 4.20m, ImageURL = "BlueShoe.jpg", Description = "Elegant and functional" }, new Lace { Colour = Colours.Yellow, Print = "Congrats Johny", Brand = Brands.Jordan, Length = 5, Price = 3.00m, ImageURL = "Bluely.jpg", Description = "A good lace to gift to someone special" }, new Lace { Colour = Colours.Blue, Brand = Brands.Puma, Length = 17, Price = 3.25m, ImageURL = "AllShoes.jpg", Description = "The perfect everyday lace" }, new Lace { Colour = Colours.Pink, Brand = Brands.Reebok, Length = 11, Price = 2.750m, ImageURL = "BlackLace.jpg", Description = "The lace that will make your shoes" }, new Lace { Colour = Colours.Cyan, Print = "Happy Mothers Day", Brand = Brands.Adidas, Length = 15, Price = 1.50m, ImageURL = "Aglets.jpg", Description = "For that special day" }, new Lace { Colour = Colours.Yellow, Brand = Brands.Fila, Length = 10, Price = 2.50m, ImageURL = "Green.jpg", Description = "Blend into nature with our green lace" } }; foreach (Lace a in laces) { context.Lace.Add(a); } context.SaveChanges(); }