public void AddSuggestion(Suggestion suggestion, string filePath)
        {
            var repo = new SuggestionRepository();
            repo.AddSuggestion(suggestion, filePath);
           

        }
Exemple #2
0
        public void AddSuggestion(Suggestion suggestion)
        {
            var repo = new SuggestionRepository();
            repo.AddSuggestion(suggestion);
           

        }
        public ActionResult AddSuggestionForm(Suggestion suggestion)
        {
            var ops = new SuggestionOperations();
            ops.AddSuggestion(suggestion);

            return View("ConfirmationPage");
        }
        public ActionResult AddSuggestionForm(Suggestion suggestion)
        {
            var ops = FileManager.CreateSuggestionOperations();
            var fullPath = Server.MapPath(@"~/Suggestions/suggestions.txt");
            ops.AddSuggestion(suggestion, fullPath);

            return View("ConfirmationPage");
        }
        public ActionResult AddSuggestionForm(Suggestion suggestion)
        {
            var filePath = Server.MapPath(@"~/Suggestions/Suggestions.txt");
            var ops = OperationsFactory.CreateSuggestionOperations();
            ops.AddSuggestion(suggestion, filePath);

            return View("ConfirmationPage");
        }
        public void AddSuggestion(Suggestion suggestion, string filePath)
        {
            var suggestionsList = GetAllSuggestions(filePath);

            int suggestionID = (suggestionsList.Max(s => s.SuggestionID) + 1);

            suggestion.SuggestionID = suggestionID;
            suggestionsList.Add(suggestion);
            OverwriteFile(suggestionsList, filePath);
        }
        public void AddSuggestion(Suggestion suggestion)
        {
            var suggestionsList = GetAllSuggestions();

            int suggestionID = (suggestionsList.Max(s => s.SuggestionID) + 1);

            suggestion.SuggestionID = suggestionID;
            suggestionsList.Add(suggestion);
            OverwriteFile(suggestionsList);
        }
        public void SubmitSuggestionTest()
        {
            var repo = new SuggestionRepository();

            var suggestion = new Suggestion()
            {
                SuggestionText = "Test",
                EmployeeName = "Johnny"
            };

            repo.AddSuggestion(suggestion);
            Assert.AreEqual("Johnny", suggestion.EmployeeName);
        }
        public void SubmitSuggestionTest()
        {
            var repo = new SuggestionRepository();

            var suggestion = new Suggestion()
            {
                SuggestionText = "Test",
                EmployeeName = "Johnny"
            };

            string filePath =
                @"C:\Users\Apprentice\Desktop\GitHub\KileyDowling\SGCorpHRV2\SGCorpHR\SGCorpHR.TEST\Suggestions\Suggestions.txt";

            repo.AddSuggestion(suggestion, filePath);
            Assert.AreEqual("Johnny", suggestion.EmployeeName);

        }
        public List<Suggestion> GetAllSuggestions(string filePath)
        {
            List<Suggestion> suggestions = new List<Suggestion>();

            var reader = File.ReadAllLines(filePath);

            for (int i = 1; i < reader.Length; i++)
            {
                var columns = reader[i].Split(',');

                var suggestion = new Suggestion();

                suggestion.SuggestionID = int.Parse(columns[0]);
                suggestion.EmployeeName = columns[1];
                suggestion.SuggestionText = columns[2];

                suggestions.Add(suggestion);
            }

            return suggestions;
        }