コード例 #1
0
        public OrderEditModels CreateOrder(OrderEditModels model, out string message)
        {
            var ship = _OrderRepository.getOrder(model.OrderId, model.CustomerId, model.EmployeeId);

            if (ship != null)
            {
                message = Constants.OrderIsExist;
                return(null);
            }
            var CreateOrder = _OrderRepository.Insert(model.MapToEditEntity());

            UnitOfwork.SaveChanges();
            if (CreateOrder == null)
            {
                message = Constants.CreateFail;
                return(null);
            }
            message = Constants.CreateSuccess;
            return(CreateOrder.MapToEditModel());
        }
コード例 #2
0
        public bool UpdateOrder(OrderEditModels model, out string message)
        {
            var OrderEntity = _OrderRepository.GetById(model.OrderId);

            if (OrderEntity != null)
            {
                var gr = _OrderRepository.getOrder(model.OrderId, model.CustomerId, model.EmployeeId);
                if (gr != null)
                {
                    message = Constants.OrderIsExist;
                    return(false);
                }
                OrderEntity = model.MapToEditEntity(OrderEntity);
                _OrderRepository.Update(OrderEntity);
                UnitOfwork.SaveChanges();
                message = Constants.UpdateSuccess;
                return(true);
            }
            message = Constants.UpdateFail;
            return(false);
        }