Exemplo n.º 1
0
        public async Task <IActionResult> EditState(OrderViewModel2 details)
        {
            if (ModelState.IsValid)
            {
                await orderRepo.UpdateState(details.OrderId, (byte)details.SelectedItemValue);

                return(Redirect($"ordersdetails?id={details.OrderId}"));
            }
            return(Redirect("AllOrders"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Rate(OrderViewModel2 details)
        {
            if (ModelState.IsValid)
            {
                var current = orderRepo.Ratings.Where(x => x.OrderId == details.OrderId).FirstOrDefault();
                if (current != null)
                {
                    await orderRepo.EditRating(details.OrderId, details.SelectedValue, details.Comment);
                }
                else
                {
                    await orderRepo.RateOrder(details.OrderId, details.SelectedValue, details.Comment);
                }

                return(Redirect("MyOrders"));
            }
            return(View("MyOrders"));
        }