예제 #1
0
        public ActionResult Update(ShortOrderViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            _orderService.Update(model.Id, model.OrderDate, model.PayingDate, model.ShippedDate);

            return(RedirectToAction("Orders"));
        }
        public void ShouldMap_OrderDto_To_ShortViewModel()
        {
            var order = new OrderDto
            {
                Id          = 1,
                OrderDate   = DateTime.UtcNow,
                PayingDate  = DateTime.UtcNow,
                ShippedDate = DateTime.UtcNow,
                CustomerId  = "1"
            };

            ShortOrderViewModel result = order.ToShortViewModel();

            Assert.AreEqual(order.Id, result.Id);
            Assert.AreEqual(order.OrderDate, result.OrderDate);
            Assert.AreEqual(order.PayingDate, result.PayingDate);
            Assert.AreEqual(order.ShippedDate, order.ShippedDate);
            Assert.AreEqual(order.CustomerId, result.CustomerId);
        }