Esempio n. 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 };
            }
        }
Esempio n. 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 };
            }

        }
Esempio n. 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 };
            }
        }