コード例 #1
0
        public IActionResult UpdateUserStartUp(UserStartup newStartUp)
        {
            UserStartup startUp = _context.UserStartup.Find(newStartUp.Id);

            if (ModelState.IsValid)
            {
                startUp.CompanyName    = newStartUp.CompanyName;
                startUp.CompanyWebsite = newStartUp.CompanyWebsite;
                startUp.DateAdded      = startUp.DateAdded;
                startUp.ReviewDate     = newStartUp.ReviewDate;
                startUp.Scout          = newStartUp.Scout;
                startUp.Source         = newStartUp.Source;
                startUp.City           = newStartUp.City;
                startUp.StateProvince  = newStartUp.StateProvince;
                startUp.Country        = newStartUp.Country;
                startUp.TwoLineSummary = newStartUp.TwoLineSummary;
                startUp.Alignment      = newStartUp.Alignment;
                startUp.Theme          = newStartUp.Theme;
                startUp.Technology     = newStartUp.Technology;
                startUp.Landscape      = newStartUp.Landscape;
                startUp.Uniqueness     = newStartUp.Uniqueness;
                startUp.Team           = newStartUp.Team;
                startUp.Raised         = newStartUp.Raised;

                _context.Entry(startUp).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _context.Update(startUp);
                _context.SaveChanges();
            }
            return(RedirectToAction("UserFavorites"));
        }
コード例 #2
0
 public IActionResult AddUserDefinedStartup(UserStartup startUp)
 {
     startUp.DateAdded = DateTime.Now;
     if (ModelState.IsValid)
     {
         _context.UserStartup.Add(startUp);
         _context.SaveChanges();
         return(RedirectToAction("SubmissionComplete", startUp));
     }
     else
     {
         return(RedirectToAction("AddUserDefinedStartup"));
     }
 }
コード例 #3
0
        public IActionResult RemoveUserStartUp(int id)
        {
            UserStartup removeStartUp = _context.UserStartup.Find(id);

            List <StartupComments> c = _context.StartupComments.Where(x => x.StartupId == id).Where(y => y.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList();

            foreach (StartupComments y in c)
            {
                _context.StartupComments.Remove(y);
            }
            // StartupComments conflict column startupId
            _context.UserStartup.Remove(removeStartUp);
            _context.SaveChanges();
            return(RedirectToAction("UserFavorites"));
        }
コード例 #4
0
        public IActionResult RemoveStartupComments(int id)
        {
            UserStartup     specificStartup    = _context.UserStartup.Find(id);
            StartupComments userStartupComment = _context.StartupComments.Find(id);

            if (ModelState.IsValid)
            {
                _context.StartupComments.Remove(userStartupComment);
                _context.SaveChanges();

                return(RedirectToAction("UserFavorites"));
            }
            else
            {
                return(RedirectToAction("DisplaySeamlessStartups"));
            }
        }
コード例 #5
0
        public async Task <IActionResult> StartupDetails(int id)
        {
            UserStartup specificStartup = _context.UserStartup.Find(id);

            if (specificStartup.Identifier != null)
            {
                Dictionary <string, MainEntry> seamlessDictionary = await _seamlessDAL.GetMainDictionary();

                MainEntry me = seamlessDictionary[specificStartup.Identifier];
                specificStartup.Alignment      = me.Alignment;
                specificStartup.City           = me.City;
                specificStartup.CompanyWebsite = me.CompanyWebsite;
                specificStartup.Country        = me.Country;
                specificStartup.Landscape      = me.Landscape;
                specificStartup.Raised         = me.Raised;
                if (DateTime.TryParse(me.ReviewDate, out DateTime r))
                {
                    specificStartup.ReviewDate = r;
                }
                specificStartup.Scout         = me.Scout;
                specificStartup.Source        = me.Source;
                specificStartup.StateProvince = me.StateProvince;
                if (int.TryParse(me.Team, out int t))
                {
                    specificStartup.Team = t;
                }
                specificStartup.Technology = me.TechnologyAreas;
                specificStartup.Theme      = me.Themes;
                if (int.TryParse(me.Uniqueness, out int u))
                {
                    specificStartup.Uniqueness = u;
                }
                specificStartup.TwoLineSummary = me.TwoLineCompanySummary;
            }
            UserStartupComments userStartupComments = new UserStartupComments()
            {
                Startups = specificStartup,
                Comments = _context.StartupComments.Where(x => x.StartupId == id).ToList(),
            };

            return(View(userStartupComments));
        }
コード例 #6
0
        public async Task <IActionResult> AddSeamlessStartupEntry(string key)
        {
            if (key == null)
            {
                return(RedirectToAction("DisplaySavedSeamlessStartupEntries"));
            }
            Dictionary <string, MainEntry> seamlessDictionary = await _seamlessDAL.GetMainDictionary();

            MainEntry   startupDetails = seamlessDictionary[key];
            UserStartup us             = new UserStartup()
            {
                Identifier  = key,
                UserId      = User.FindFirstValue(ClaimTypes.NameIdentifier),
                DateAdded   = DateTime.Parse(startupDetails.DateAdded),
                CompanyName = startupDetails.CompanyName
            };
            List <UserStartup> userStartups = await _context.UserStartup.Where(x => x.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToListAsync();

            bool found = false;

            foreach (UserStartup y in userStartups)
            {
                if (y.CompanyName == us.CompanyName)
                {
                    found = true;
                }
            }
            if (!found)
            {
                _context.UserStartup.Add(us);
                _context.SaveChanges();
                return(RedirectToAction("UserFavorites"));
            }
            else
            {
                TempData["Status"] = "This Favorite has already been added!";

                return(RedirectToAction("UserFavorites"));
            }
        }
コード例 #7
0
 public IActionResult SubmissionComplete(UserStartup startUp)
 {
     return(View(startUp));
 }
コード例 #8
0
        public IActionResult UpdateUserStartUp(int id)
        {
            UserStartup editStartUp = _context.UserStartup.Find(id);

            return(View(editStartUp));
        }
コード例 #9
0
        public IActionResult ConfirmRemoveUserStartUp(int id)
        {
            UserStartup removeStartUp = _context.UserStartup.Find(id);

            return(View(removeStartUp));
        }