public JsonResult Upload() { var files = Request.Form.Files; var uploads = Path.Combine(_environment.WebRootPath, "uploads"); var user = _repo.GetUserById(User.GetUserId()); foreach (var file in files) { if (file.Length > 0) { var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); file.SaveAs(Path.Combine(uploads, fileName)); if (!_transactionImportService.ImportTransactions(fileName, user)) { return(Json(false)); } } } return(Json(true)); }
public JsonResult GetCurrentUser() { User user = _repo.GetUserById(User.GetUserId()); return(Json(Mapper.Map <UserViewModel>(user))); }