public FoundationBudget GetNewBudget() { var budgetEntity = BusinessManager.InitializeEntity(Constant.Classes.Budget); budgetEntity.PrimaryKeyId = BusinessManager.Create(budgetEntity); var budget = new FoundationBudget(budgetEntity); budget.SaveChanges(); return(budget); }
private void UpdateBudgetEntity(FoundationBudget budgetEntity, BudgetViewModel budgetModel) { budgetEntity.Amount = budgetModel.Amount; budgetEntity.Currency = budgetModel.Currency; budgetEntity.StartDate = budgetModel.StartDate; budgetEntity.DueDate = budgetModel.DueDate; budgetEntity.Status = budgetModel.Status; budgetEntity.PurchaserName = budgetModel.PurchaserName; budgetEntity.LockAmount = budgetModel.LockAmount; if (budgetModel.OrganizationId != Guid.Empty) { budgetEntity.OrganizationId = budgetModel.OrganizationId; } if (budgetModel.ContactId != Guid.Empty) { budgetEntity.ContactId = budgetModel.ContactId; } budgetEntity.SaveChanges(); }