public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,ImageUrl,IsPopularItem")] Clothes clothes) { if (ModelState.IsValid) { cr.Add(clothes); await cr.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(clothes)); }
public async Task <IActionResult> Create([Bind("Id,Name,Price,Description,ImageUrl,IsPopularItem,ServicesId")] Clothes clothes) { if (ModelState.IsValid) { cr.Add(clothes); await cr.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["ServicesId"] = new SelectList(sr.GetAll(), "Id", "Name", clothes.ServicesId); return(View(clothes)); }