public void ChangeStatus(StockStatuses stockStatusId) { if (this.StockStatusId == stockStatusId) { throw new Exception("Same stock status"); } if (IsValidChangeStatus(stockStatusId)) { throw new Exception("Not change stock status from blocked status to return status"); } this.StockStatusId = StockStatusId; }
public bool IsValidChangeStatus(StockStatuses stockStatusId) { return(!(this.StockStatusId == StockStatuses.BLOCKED && stockStatusId == StockStatuses.RETURN)); }