Example #1
0
        public ActionResult Edit([Bind(Include = "DepartmentId,DepartmentName,TenantId,AccountID,DateCreated,DateUpdated,CreatedBy,UpdatedBy,IsDeleted")] TenantDepartments tenantDepartments)
        {
            if (ModelState.IsValid)
            {
                tenantDepartments.DepartmentId = tenantDepartments.DepartmentId;
                tenantDepartments.CreatedBy    = CurrentUserId;
                tenantDepartments.TenantId     = CurrentTenantId;

                _LookupService.UpdateTenantDepartment(tenantDepartments);
                return(RedirectToAction("Index"));
            }
            var accounts = AccountServices.GetAllValidAccounts(CurrentTenantId).Select(acnts => new
            {
                acnts.AccountID,
                acnts.AccountNameCode
            }).ToList();

            ViewBag.AccountIDs = new SelectList(accounts, "AccountID", "AccountNameCode", tenantDepartments.AccountID);
            //ViewBag.TenantId = new SelectList(db.Tenants, "TenantId", "TenantName", tenantDepartments.TenantId);
            return(View(tenantDepartments));
        }