public IActionResult Fileconfirm(FileViewModel model, [FromServices] DBDeiba dB) { File file = new File { Name = model.Name }; if (model.Listlaptop != null) { byte[] b = new byte[model.Listlaptop.Length]; model.Listlaptop.OpenReadStream().Read(b, 0, b.Length); file.Listlaptop = b; } if (model.Listmobile != null) { byte[] a = new byte[model.Listmobile.Length]; model.Listmobile.OpenReadStream().Read(a, 0, a.Length); file.Listmobile = a; } dB.Add(file); dB.SaveChanges(); return(RedirectToAction("Fileinsert", "Panel")); }
public IActionResult Productconfirm(ProductViewModel model, [FromServices] DBDeiba dB) { Product a = new Product { Name = model.Name, Price = model.Price, Title = model.Title, Barandid = model.Barandid }; if (model.Img != null) { if (model.Img.Length < 5 * Math.Pow(1024, 2)) { byte[] b = new byte [model.Img.Length]; model.Img.OpenReadStream().Read(b, 0, b.Length); a.Img = b; } } dB.Add(a); dB.SaveChanges(); return(RedirectToAction("PanelManager", "Panel")); }
public IActionResult Barandconfirm(BarandViewModel model, [FromServices] DBDeiba dB) { Barand b = new Barand { Name = model.Name }; dB.Add(b); dB.SaveChanges(); return(RedirectToAction("InsertBarand", "Panel")); }
public IActionResult Postconfirm(PostViewModel model, [FromServices] DBDeiba dB) { Post post = new Post { Name = model.Name, Title = model.Title }; dB.Add(post); dB.SaveChanges(); return(RedirectToAction("Postinsert", "Post")); }