//[HttpGet] //public IActionResult Ekle() //{ // _model.CategoryDrop = _repcat.ComboDoldur(_model.CategoryDrop); // return View(_model); //} //[HttpPost] //public async Task<IActionResult> Ekle(IFormFile photo, ProductModel model) //{ // List<Gallery> glry = new List<Gallery>(); // _db.Entry(model.Products).State = Microsoft.EntityFrameworkCore.EntityState.Added; // if (photo == null || photo.Length == 0) // { // return Content("Resim Bulunamadı. Resimsiz Ürün Eklenemez."); // } // else // { // var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/", photo.FileName); // using (var stream = new FileStream(path, FileMode.Create)) // { // await photo.CopyToAsync(stream); // } // model.Products.Image = photo.FileName; // glry.Add(new Gallery // { // ProductId = model.Products.ProductId, // Image = null, // }); // foreach (var item in glry) // { // _rep.Add(item); // } // await _rep.Save(); // return RedirectToAction("ProductsListe", "Products"); // } //} //public IActionResult EkleCoklu() //{ // return View(); //} public async Task <IActionResult> EkleCoklu(int id) { _model.Products = await _reppro.Find(id); return(View(_model)); }
public async Task <IActionResult> Detay(int id) { Products p = await _rep.Find(id); return(Json(p)); }