public ActionResult ProcessIncomingExpenditures() { var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone(); nfi.NumberGroupSeparator = " "; var model = new ProcessIncomingExpenditureViewModel { DeskGroups = (from d in _db.DeskGroups where d.IsActive select new KeyValuePair <int, string>(d.DeskGroupId, d.Name)).ToList() }; return(PartialView(model)); }
public ActionResult ProcessIncomingExpenditure(int id) { var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone(); nfi.NumberGroupSeparator = " "; var model = new ProcessIncomingExpenditureViewModel { Expenditure = _db.IncomingExpenditures.FirstOrDefault(e => e.IncomingExpenditureId == id), ExpenditureObjects = new SelectList( (from o in _db.ExpenditureObjects.Where(o => o.IsActive).OrderBy(o => o.Description) select new { Id = o.ExpenditureObjectId, Name = o.Description }).ToList(), "Id", "Name"), DeskGroups = (from d in _db.DeskGroups where d.IsActive select new KeyValuePair <int, string>(d.DeskGroupId, d.Name)).ToList() }; var counterparty = (from c in _db.Counterparties join fao in _db.FinancialAccountOperations on c.ITN equals fao.CounterpartyId where fao.FinancialAccountOperationId == model.Expenditure.FinancialAccountOperationId select c).FirstOrDefault(); if (counterparty != null) { if (counterparty.ExpenditureObjectId != null) { model.ExpenditureObjects.FirstOrDefault(e => e.Value == counterparty.ExpenditureObjectId.ToString()).Selected = true; } } return(PartialView(model)); }