public static ExpenseItem ToModel(this DataAccessLayer.ExpenseDetail entity)
        {
            if (entity == null)
                return null;

            var expenseItem = new ExpenseItem
            {
                Id = entity.Id,
                Amount = Convert.ToDouble(entity.Amount),
                Description = entity.Description,
            };

            return expenseItem;
        }
        public static ExpenseItem ToModel(this DataAccessLayer.ExpenseDetail entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var expenseItem = new ExpenseItem
            {
                Id          = entity.Id,
                Amount      = Convert.ToDouble(entity.Amount),
                Description = entity.Description,
            };

            return(expenseItem);
        }
        protected void OnAddNewExpenseItemClick(object sender, EventArgs e)
        {
            this.Validate("AddNewExpenseItem");
            /// Here must be placed all the extra validations for the inputs 
            /// (like length, potentially dangerous characters, etc.)
            if (this.IsValid)
            {
                var item = new ExpenseItem
                        {
                            Id = Guid.NewGuid(),
                            Description = this.ExpenseItemDescription.Text,
                            Amount = double.Parse(this.ExpenseItemAmount.Text, CultureInfo.CurrentCulture),
                        };
                this.ExpenseItems.Add(item);
                this.ExpenseItemDescription.Text = string.Empty;
                this.ExpenseItemAmount.Text = string.Empty;
            }

            this.ExpenseItemsGridView.DataSource = this.ExpenseItems;
            this.ExpenseItemsGridView.DataBind();
        }