public ActionResult Create([Bind(Include = "id,date,nomer,id_type,id_kontr, countRow")] TTN tTN, int countRow)
 {
     ViewBag.id_TTN = tTN.id;
     if (ModelState.IsValid)
     {
         db.TTN.Add(tTN);
         db.SaveChanges();
         TempData["id_kontr"] = tTN.id_kontr;
         TempData["countRow"] = countRow;
         TempData["idTTN"]    = tTN.id;
         TempData["idType"]   = tTN.id_type;
         return(RedirectToAction("addROW"));
     }
     ViewBag.id_kontr = new SelectList(db.kontragents, "id", "name", tTN.id_kontr);
     ViewBag.id_type  = new SelectList(db.type_TTN, "id", "name", tTN.id_type);
     return(View(tTN));
 }
示例#2
0
        public async Task <Unit> Handle(EditOrderLocationInput request, CancellationToken cancellationToken)
        {
            var ttn   = new TTN(request.Ttn);
            var order = await _orderRepository.FindOrderAsync(ttn, cancellationToken);

            var newLocation = new Location(request.NewLocation.City, request.NewLocation.Street);

            order.ChangeLocation(newLocation);

            await _orderRepository.UpdateAsync(order, cancellationToken);

            await _outputContext.NotifyAll().OrderLocationChanged(new OrderLocationChangedViewModel
            {
                Ttn      = request.Ttn,
                Location = request.NewLocation,
            });

            return(Unit.Value);
        }
 public OrderStatusCannotBeChangedException(TTN orderTtn, OrderStatus currentStatus, OrderStatus nextStatus)
     : base($"Cannot change status for order: '{orderTtn.Value}' from {currentStatus} to {nextStatus}'")
 {
 }
示例#4
0
        public Task <Order> FindOrderAsync(TTN ttn, CancellationToken cancellationToken)
        {
            var filter = Builders <Order> .Filter.Eq(x => x.Identifier.Value, ttn.Value);

            return(_orderCollection.Find(_mongoContext.Session, filter).SingleAsync(cancellationToken));
        }
 public OrderDoesNotContainCargoException(TTN orderTtn, CargoNumber cargoNumber)
     : base($"Order {orderTtn.Value} does not contain cargo {cargoNumber}")
 {
 }
 public OrderAlreadyContainsCargoException(TTN orderTtn, CargoNumber cargoNumber)
     : base($"Order {orderTtn.Value} already contains cargo {cargoNumber}")
 {
 }