public async Task <IActionResult> Order(ProductOrderInputModel productOrderInputModel) { OrderServiceModel orderServiceModel = productOrderInputModel.To <OrderServiceModel>(); orderServiceModel.IssuerId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.orderService.CreateOrder(orderServiceModel); return(this.Redirect("/")); }
public async Task <IActionResult> Order(ProductOrderInputModel inputModel) { OrderServiceModel orderServiceModel = inputModel.To <OrderServiceModel>(); //orderServiceModel.IssuerId = this.User.Identity.Name; //note: това търси този, който го е създал, а не този, който купува!!!! ????? orderServiceModel.IssuerId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.orderService.CreateOrder(orderServiceModel); return(this.Redirect("/Home/Index")); }
public async Task <IActionResult> Order(ProductOrderInputModel productOrderInputModel) { if (!ModelState.IsValid) { return(this.Redirect($"/Product/Details/{productOrderInputModel.ProductId}")); } var orderServiceModel = productOrderInputModel.To <OrderServiceModel>(); orderServiceModel.IssuerId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; await this.orderService.CreateOrder(orderServiceModel); return(this.Redirect("/")); }