Beispiel #1
0
        public ActionResult NewOrder(NewOrderBm newOrderBm)
        {
            if (!this.ModelState.IsValid)
            {
                return(RedirectToAction("NewOrder"));
            }

            this._service.AddNewOrder(newOrderBm);
            return(this.RedirectToAction("Orders"));
        }
Beispiel #2
0
        public IHttpActionResult CreateOrder([FromBody] NewOrderBm newOrderBm)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.StatusCode(HttpStatusCode.BadRequest));
            }

            this._service.AddNewOrder(newOrderBm);

            return(StatusCode(HttpStatusCode.Created));
        }
Beispiel #3
0
        public void AddNewOrder(NewOrderBm newOrderBm)
        {
            SugarSachet sachet = this.Context.SugarSachets.Find(newOrderBm.Id);
            Order       order  = new Order();

            order.OrderDate          = DateTime.Today;
            order.PaperKg            = newOrderBm.PaperKg;
            order.OrderStatus        = OrderStatus.Ordered;
            order.SachetUniqueNumber = sachet.UniqueNumber;
            order.ClientPrefix       = sachet.ClientPrefix.PrefixName;

            this.Context.Orders.Add(order);
            this.Context.SaveChanges();
        }