Ejemplo n.º 1
0
        public BudgetItemViewModel CreateForShipOwner(ShipOwnerViewModel shipOwner)
        {
            if (shipOwner == null)
            {
                throw new ArgumentNullException("shipOwner is null or empty!");
            }
            var item = Create();

            item.GetEntity().SetShipOwner(shipOwner.GetEntity());
            return(item);
        }
Ejemplo n.º 2
0
        public bool CopyWithChildrenItemsToShipOwner(BudgetItemViewModel budgetItem, ShipOwnerViewModel shipOwner)
        {
            if (budgetItem == null)
            {
                throw new ArgumentNullException("Arg budgetItem is null!");
            }
            if (shipOwner == null)
            {
                throw new ArgumentNullException("Arg shipOwner is null!");
            }
            if (budgetItem.Id <= 0)
            {
                throw new ArgumentOutOfRangeException("Arg budgetItem.Id not more zero!");
            }
            if (shipOwner.Id <= 0)
            {
                throw new ArgumentOutOfRangeException("Arg shipOwner.Id not more zero!");
            }

            var        service = Domain.Services.Factories.BudgetItemServicesFactory.CreateBudgetItemCopyService();
            BudgetItem copy    = service.CopyBudgetItemWithChildrenItemsToShipowner(budgetItem.Id, shipOwner.Id);

            return(copy != null);
        }