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));
        }
Exemplo n.º 2
0
        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));
        }