// GET: DataSources/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var dataSource = manager.GetById(id.Value, Client); if (dataSource == null) { return(HttpNotFound()); } return(View(dataSource)); }
// GET: Transactions public ActionResult Index([Bind(Prefix = "id")] int dataSourceId) { var dataSource = _dataSourceManager.GetById(dataSourceId, Client); IEnumerable <Transaction> transactions = _transactionManager.Get(dataSource); var model = new TransactionsViewModel { DataSource = string.IsNullOrWhiteSpace(dataSource.ClientName) ? dataSource.BankAccount : dataSource.ClientName + " - " + dataSource.BankAccount, Transactions = transactions, DataSourceId = dataSource.Id }; return(View(model)); }
public ActionResult Upload([Bind(Prefix = "id")] int dataSourceId) { if (Request.Files.Count > 0) { var file = Request.Files[0]; if ((file != null) && (file.ContentLength > 0)) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/UploadedContent/"), fileName); file.SaveAs(path); var dataSource = _dataSourceManager.GetById(dataSourceId, Client); var response = _transactionManager.Insert(dataSource, path); HandleResponse(response); } } return(RedirectToAction("Index", new { id = dataSourceId })); }