コード例 #1
0
        public ActionResult Get(int orderID)
        {
            Domain.WorkOrder order = null;
            try
            {
                order = serv.Get(orderID);
                if (order.EmployerID != Employer.ID)
                {
                    throwInvalidOrder(orderID);
                }
            }
            catch
            {
                throwInvalidOrder(orderID);
            }

            // TODO: Not mapping to view object throws JsonSerializationException, good to test error
            // handling with...(delay in error)
            ViewModel.Api.WorkOrder result = map.Map <Domain.WorkOrder, ViewModel.Api.WorkOrder>(order);
            return(new JsonResult(new { data = result }));
        }
コード例 #2
0
        public new ActionResult <WorkOrderVM> Get(int orderID)
        {
            WorkOrder order = null;

            try
            {
                order = serv.Get(orderID);
                if (order.EmployerID != Employer.ID)
                {
                    throwInvalidOrder(orderID);
                }
            }
            catch
            {
                throwInvalidOrder(orderID);
            }

            // TODO: Not mapping to view object throws JsonSerializationException, good to test error
            // handling with...(delay in error)
            WorkOrderVM result = map.Map <WorkOrder, WorkOrderVM>(order);

            return(Ok(new { data = result }));
        }