Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Orders.Models;
  7.  
  8. namespace Orders.Controllers
  9. {
  10.     public class HomeController : Controller
  11.     {
  12.  
  13.         private OrderBaza baza = new OrderBaza();
  14.  
  15.         public ActionResult Index()
  16.         {
  17.             return View();
  18.         }
  19.  
  20.  
  21.         public ActionResult Orders()
  22.         {
  23.             ViewBag.listOrders = baza.Orders.ToList<Order>();
  24.  
  25.             return View();
  26.         }
  27.  
  28.         public ActionResult Confirm(Guid userid, string status)
  29.         {
  30.             Order confirmedOrder = baza.Orders.Find(userid);
  31.  
  32.             confirmedOrder.Completed_On = DateTime.UtcNow;
  33.             confirmedOrder.Status = status;
  34.  
  35.  
  36.             return View("Orders");
  37.         }
  38.  
  39.  
  40.         public ActionResult Pay()
  41.         {
  42.             Order newOrder;
  43.  
  44.             baza.Orders.Add(newOrder = new Order
  45.             {
  46.                 Order_Id = Guid.NewGuid(),
  47.                 Product_Name = "Gold",
  48.                 Amount = 5,
  49.                 Created_On = DateTime.Now
  50.             });
  51.  
  52.             baza.SaveChanges();
  53.  
  54.             ViewBag.urlString = $"https://stage.centili.com/widget/WidgetModule?api=ce797d8eeab183872300e64cd877a4e3&clientid={newOrder.Order_Id}&country=RS";
  55.  
  56.             return View("Widget");
  57.         }
  58.  
  59.  
  60.  
  61.  
  62.         public ActionResult About()
  63.         {
  64.             ViewBag.Message = "Your application description page.";
  65.  
  66.             return View();
  67.         }
  68.  
  69.         public ActionResult Contact()
  70.         {
  71.             ViewBag.Message = "Your contact page.";
  72.  
  73.             return View();
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement