Пример #1
0
        public ActionResult AddTOPost()
        {
            var order = (OrderViewModel)Session["Order"];
            var _TO   = new OrderTOViewModel
            {
                TOId   = int.Parse(Request["Id"]),
                TOName = _TOService.GetElement(int.Parse(Request["Id"])).TOName,
                Amount = int.Parse(Request["Amount"])
            };

            order.OrderTOs.Add(_TO);
            Session["Order"] = order;
            return(RedirectToAction("Index"));
        }
Пример #2
0
        private void FormTO_Load(object sender, EventArgs e)
        {
            if (id.HasValue)
            {
                try
                {
                    TOViewModel _TOView = _TO.GetElement(id.Value);
                    if (_TOView != null)
                    {
                        textBoxName.Text  = _TOView.TOName;
                        textBoxPrice.Text = _TOView.Price.ToString();
                        _TODetails        = _TOView.TODetails;
                        LoadData();
                    }

                    LoadData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
            else
            {
                _TODetails = new List <TO_DetailViewModel>();
            }
        }
Пример #3
0
        // GET: TOs/Details/5
        public ActionResult Details(int id)
        {
            var _TO = Service.GetElement(id);

            if (_TO == null)
            {
                return(HttpNotFound());
            }
            return(View(_TO));
        }