コード例 #1
0
        public virtual Order ToEntity(int customerId)
        {
            var order = new Order
            {
                CustomerId = customerId,
                Description = Description,
                Amount = Amount
            };

            return order;
        }
コード例 #2
0
        public override Order ToEntity(int orderId)
        {
            var order = new Order
            {
                Id = orderId,
                CustomerId = CustomerId,
                Description = Description,
                Amount = Amount
            };

            return order;
        }
コード例 #3
0
        public IHttpActionResult Delete(int customerId, int orderId)
        {
            var entity = new Order(orderId, customerId);

            var serviceResult = _service.Remove(entity);

            if (serviceResult.Success)
            {
                return NoContent();
            }

            return NotFound();
        }
コード例 #4
0
        public override ServiceResult<Order> Update(Order order)
        {
            var result = new ServiceResult<Order>();

            if (ThrowError)
            {
                result.AddModelError("", "Fake Error");
            }
            else
            {
                result.Entity = order;
                result.Entity.OrderId = 1;
            }

            return result;
        }
コード例 #5
0
 public CreateOrderViewModel(Order order)
 {
     CustomerId = order.CustomerId;
     Description = order.Description;
     Amount = order.Amount;
 }
コード例 #6
0
 public UpdateOrderViewModel(Order order)
     : base(order)
 {
     OrderId = order.Id;
 }