Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("OrganizerId,FullName,RegistrationDate,Occupation")] Organizer organizer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(organizer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizer));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("FormId,FullName,AvailableAudienceSize")] Form form)
        {
            if (ModelState.IsValid)
            {
                _context.Add(form);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(form));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("ParticipantId,FullName,BirthDate,RegistrationDate,Occupation,Institution")] Participant participant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(participant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(participant));
        }
        public async Task <IActionResult> Create([Bind("LocationId,Country,City,Capacity")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("WorkId,ParticipantId,Title,Topic,PublicationDate,ConferenceId")] Work work)
        {
            if (ModelState.IsValid)
            {
                _context.Add(work);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(work));
        }
        public async Task <IActionResult> Create([Bind("WorkAndParticipantId,WorkId,ParticipantId")] WorksAndParticipant worksAndParticipant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(worksAndParticipant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ParticipantId"] = new SelectList(_context.Participants, "ParticipantId", "FullName", worksAndParticipant.ParticipantId);
            ViewData["WorkId"]        = new SelectList(_context.Works, "WorkId", "Title", worksAndParticipant.WorkId);
            return(View(worksAndParticipant));
        }
        public async Task <IActionResult> Create([Bind("ConferenceAndParticipantId,ParticipantId,ConferenceId")] ConferencesAndParticipant conferencesAndParticipant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(conferencesAndParticipant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ConferenceId"]  = new SelectList(_context.Conferences, "ConferenceId", "Aim", conferencesAndParticipant.ConferenceId);
            ViewData["ParticipantId"] = new SelectList(_context.Participants, "ParticipantId", "FullName", conferencesAndParticipant.ParticipantId);
            return(View(conferencesAndParticipant));
        }
        public async Task <IActionResult> Create([Bind("ConferenceId,Title,Aim,Topic,FormId,RequirementsForWorks,RequirementsForParticipants,Price,DateAndTime,OrganizerId,LocationId")] Conference conference)
        {
            if (ModelState.IsValid)
            {
                _context.Add(conference);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FormId"]      = new SelectList(_context.Forms, "FormId", "FullName", conference.FormId);
            ViewData["LocationId"]  = new SelectList(_context.Locations, "LocationId", "City", conference.LocationId);
            ViewData["OrganizerId"] = new SelectList(_context.Organizers, "OrganizerId", "FullName", conference.OrganizerId);
            return(View(conference));
        }
        public async Task <IActionResult> Create(int locationId, [Bind("ConferenceId,Title,Aim,Topic,FormId,RequirementsForWorks,RequirementsForParticipants,Price,DateAndTime,OrganizerId,LocationId")] Conference conference)
        {
            conference.LocationId = locationId;
            if (ModelState.IsValid)
            {
                _context.Add(conference);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));

                return(RedirectToAction("Index", "Conferences", new { id = locationId, name = _context.Locations.Where(c => c.LocationId == locationId).FirstOrDefault().City }));
            }
            ViewData["FormId"] = new SelectList(_context.Forms, "FormId", "AvailableAudienceSize", conference.FormId);
            //ViewData["LocationId"] = new SelectList(_context.Locations, "LocationId", "City", conference.LocationId);
            ViewData["OrganizerId"] = new SelectList(_context.Organizers, "OrganizerId", "FullName", conference.OrganizerId);
            //return View();

            return(RedirectToAction("Index", "Conferences", new { id = locationId }));
            //_context.Locations.Where(c => c.LocationId == locationId).FirstOrDefault().City
        }