Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, ClothesFormServiceModel model)
        {
            await this.clothes.EditAsync(
                id,
                model.Name,
                model.Type,
                model.Quantity,
                model.Size,
                model.SinglePrice,
                model.PictureUrl,
                model.Description);

            return(RedirectToAction(nameof(Details), new { id = id }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Add(ClothesFormServiceModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await this.userManager.GetUserAsync(User);

            await this.clothes.AddAsync(
                user.Id,
                model.Name,
                model.Type,
                model.Quantity,
                model.Size,
                model.SinglePrice,
                model.PictureUrl,
                model.Description);

            return(RedirectToAction(nameof(HomeController.Index), "Home"));
        }