예제 #1
0
        public BaseResponse DeleteOrder(OrderModelRequest entity)
        {
            try
            {
                var orderEntity = entity.MapTo<OrderEntity>();
                orderRepository.DeleteOrder(orderEntity);

                return new BaseResponse { IsSuccess = true };
            }
            catch (Exception ex)
            {
                return new BaseResponse { IsSuccess = false, Msg = ex.Message };
            }
        }
예제 #2
0
        public OrderModelResponse AddOrder(OrderModelRequest entity)
        {
            try
            {
                var orderEntity = entity.MapTo<OrderEntity>();
               
                long id = orderRepository.AddOrder(orderEntity);

                return id > 0 ? new OrderModelResponse { OrderId = id, IsSuccess = true } : new OrderModelResponse { IsSuccess = false, OrderId = 0 };
            }
            catch(Exception ex)
            {
                return new OrderModelResponse { OrderId = 0, IsSuccess = false, Msg = ex.Message };
            }

        }
예제 #3
0
        public BaseResponse UpdateOrder(OrderModelRequest entity)
        {
            try
            {
                var orderEntity = entity.MapTo<OrderEntity>();
                var ordermodel = orderRepository.GetOrder(orderEntity.OrderId);

                if (ordermodel == null)
                    return new BaseResponse { IsSuccess = false, Msg = "can not find mddel" };

             
                bool result = orderRepository.UpdateOrder(ordermodel);

                return result ? new BaseResponse { IsSuccess = true } : new BaseResponse { IsSuccess = false};
            }
            catch (Exception ex)
            {
                return new BaseResponse { IsSuccess = false, Msg = ex.Message };
            }
        }
예제 #4
0
        public OrderModelResponse GetOrder(OrderModelRequest entity)
        {
            try
            {
                OrderEntity order = orderRepository.GetOrder(entity.OrderId);

                return order.MapTo<OrderModelResponse>();
            }
            catch (Exception)
            {
                return null;
            }
        }