public async Task <IActionResult> Order(int id) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); await this.orders.Create(id, userId); TempData.AddSuccessMessage($"Product ordered successfully!"); return(ControllerExtensions.RedirectToHomeIndex(this)); }
public async Task <IActionResult> Create(ProductFormAdminViewModel model) { if (!ModelState.IsValid) { return(View(model)); } await this.products.CreateAsync(model.Name, model.Price, model.Description, model.Type); return(ControllerExtensions.RedirectToHomeIndex(this)); }
public async Task <IActionResult> Destroy(int id) { await this.products.Delete(id); return(ControllerExtensions.RedirectToHomeIndex(this)); }