public ActionResult Create(Budgets_BasketsToAllocation budgets_permissionstoallocation) { using (BasketsToAllocationsRepository perToAllRep = new BasketsToAllocationsRepository()) { perToAllRep.Create(budgets_permissionstoallocation); return RedirectToAction("PermissionAllocationList", "PermissionsAllocations", new { permissionId = budgets_permissionstoallocation.BasketId, budgetId = budgets_permissionstoallocation.BudgetId }); } }
public ActionResult Create(int permissionId, int budgetId) { Budgets_BasketsToAllocation perAlloc = new Budgets_BasketsToAllocation(); using (BudgetsRepository budgetsRepository = new BudgetsRepository(CurrentUser.CompanyId)) using (BudgetsPermissionsRepository permissionsRepository = new BudgetsPermissionsRepository()) using (AllocationRepository allocationRepository = new AllocationRepository(CurrentUser.CompanyId)) { ViewBag.AllocationList = new SelectList(allocationRepository.GetList().Where(x => x.BudgetId == budgetId).OrderBy(x => x.ExternalId).ToList(), "Id", "DisplayName"); //ViewBag.BudgetsAllocationId = new SelectList(db.Budgets_Allocations, "Id", "Id"); perAlloc.BudgetId = budgetId; perAlloc.BasketId = permissionId; Budget budget = budgetsRepository.GetEntity(budgetId); ViewBag.budgetYear = budget.Year; Budgets_Baskets permission = permissionsRepository.GetEntity(permissionId); ViewBag.PermissionName = permission.Name; } return View(perAlloc); }
public ActionResult BudgetBaskets(int id = 0, int page = FIRST_PAGE, string sortby = DEFAULT_SORT, string order = DEFAULT_DESC_ORDER) { if (!Authorized(RoleType.SystemManager)) return Error(Loc.Dic.error_no_permission); IEnumerable<Budgets_Baskets> baskets; Budgets_BasketsToAllocation per = new Budgets_BasketsToAllocation(); using (BudgetsRepository budgetsRep = new BudgetsRepository(CurrentUser.CompanyId)) using (BudgetsPermissionsRepository permissionsRep = new BudgetsPermissionsRepository()) { baskets = permissionsRep.GetList("Budgets_BasketsToAllocation").Where(x => x.CompanyId == CurrentUser.CompanyId); baskets = Pagination(baskets, page, sortby, order, true); ViewBag.budgetId = id; Budget budget = budgetsRep.GetList().SingleOrDefault(x => x.Id == id); ViewBag.budgetYear = budget.Year; ViewBag.budgetId = budget.Id; return View(baskets.ToList()); } }
/// <summary> /// Deprecated Method for adding a new object to the Budgets_BasketsToAllocation EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBudgets_BasketsToAllocation(Budgets_BasketsToAllocation budgets_BasketsToAllocation) { base.AddObject("Budgets_BasketsToAllocation", budgets_BasketsToAllocation); }
/// <summary> /// Create a new Budgets_BasketsToAllocation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="budgetId">Initial value of the BudgetId property.</param> /// <param name="basketId">Initial value of the BasketId property.</param> /// <param name="budgetsAllocationId">Initial value of the BudgetsAllocationId property.</param> public static Budgets_BasketsToAllocation CreateBudgets_BasketsToAllocation(global::System.Int32 id, global::System.Int32 budgetId, global::System.Int32 basketId, global::System.Int32 budgetsAllocationId) { Budgets_BasketsToAllocation budgets_BasketsToAllocation = new Budgets_BasketsToAllocation(); budgets_BasketsToAllocation.Id = id; budgets_BasketsToAllocation.BudgetId = budgetId; budgets_BasketsToAllocation.BasketId = basketId; budgets_BasketsToAllocation.BudgetsAllocationId = budgetsAllocationId; return budgets_BasketsToAllocation; }
public ActionResult Edit(Budgets_BasketsToAllocation budgets_permissionstoallocation) { if (ModelState.IsValid) { db.Budgets_BasketsToAllocation.Attach(budgets_permissionstoallocation); db.ObjectStateManager.ChangeObjectState(budgets_permissionstoallocation, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.BudgetsAllocationId = new SelectList(db.Budgets_Allocations, "Id", "Id", budgets_permissionstoallocation.BudgetsAllocationId); ViewBag.BasketId = new SelectList(db.Budgets_Baskets, "Id", "Name", budgets_permissionstoallocation.BasketId); return View(budgets_permissionstoallocation); }