public async Task <IActionResult> UploadFile(IFormFile file)
        {
            if (file != null)
            {
                var resourceFolderPath = Path.GetFullPath("Resources\\");
                if (file.Length > 0)
                {
                    using (var stream = new FileStream(resourceFolderPath + file.FileName, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);
                    }
                }
                else
                {
                    return(RedirectToAction(nameof(Error)));
                }

                var filePath = resourceFolderPath + file.FileName;

                var manager = new EmployeeManager(filePath);
                var result  = manager.CalculateMostWorkedEmployeesInProject();

                return(View(result));
            }
            else
            {
                return(RedirectToAction(nameof(Error)));
            }
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            var pathtoFile = @"C:\Users\ASUS K53SM\Desktop\Employees.txt";
            var manager    = new EmployeeManager(pathtoFile);

            var result = manager.CalculateMostWorkedEmployeesInProject();
        }