Exemplo n.º 1
0
        public IActionResult Report(int id)
        {
            ScientificEvent ScientificEvent = _context.ScientificEvents.Where(m => m.Id == id).SingleOrDefault();

            if (ScientificEvent == null)
            {
                return(NotFound());
            }
            ScientificEvent.ReportType = ReportType.NotRelated;
            _context.SaveChanges();
            return(RedirectToAction("Details/" + id));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EventNameAr,EventNameEn,EventType,CountryId,Venue,Date,SpecialityId,Organizers,ApplicationUserId,ContactDetails,IsFeatured,IsVisible,IsAccepted,Website,IsDecisionMaker,Description,EventDate,AridPrivileges,Image,ReportType")] ScientificEvent scientificEvent, IFormFile myfile)
        {
            if (id != scientificEvent.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    scientificEvent.Image = await UserFile.UploadeNewImageAsync(scientificEvent.Image,
                                                                                myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                    scientificEvent.Description = (System.Text.RegularExpressions.Regex.Replace(scientificEvent.Description, @"(?></?\w+)(?>(?:[^>'""]+|'[^']*'|""[^""]*"")*)>", String.Empty)).Replace("\n", "<br/>");
                    _context.Update(scientificEvent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ScientificEventExists(scientificEvent.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "ArName", scientificEvent.ApplicationUserId);
            ViewData["CountryId"]         = new SelectList(_context.Countries, "Id", "ArCountryName", scientificEvent.CountryId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "Name", scientificEvent.SpecialityId);

            return(View(scientificEvent));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,EventNameAr,EventNameEn,EventType,CountryId,Venue,Date,SpecialityId,Organizers,ApplicationUserId,ContactDetails,IsFeatured,IsVisible,IsAccepted,Website,IsDecisionMaker,Description,EventDate,AridPrivileges,Image,ReportType")] ScientificEvent scientificEvent, IFormFile myfile)
        {
            if (ModelState.IsValid)
            {
                scientificEvent.ApplicationUserId = _userManager.GetUserId(User);
                scientificEvent.Date       = DateTime.Now;
                scientificEvent.ReportType = ReportType.None;
                scientificEvent.IsAccepted = true;
                scientificEvent.IsVisible  = true;

                scientificEvent.Image = await UserFile.UploadeNewImageAsync(scientificEvent.Image,
                                                                            myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                scientificEvent.Description = (System.Text.RegularExpressions.Regex.Replace(scientificEvent.Description, @"(?></?\w+)(?>(?:[^>'""]+|'[^']*'|""[^""]*"")*)>", String.Empty)).Replace("\n", "<br/>");
                _context.Add(scientificEvent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "ArName", scientificEvent.ApplicationUserId);
            ViewData["CountryId"]         = new SelectList(_context.Countries, "Id", "ArCountryName", scientificEvent.CountryId);
            ViewData["SpecialityId"]      = new SelectList(_context.Specialities, "Id", "Name", scientificEvent.SpecialityId);
            return(View(scientificEvent));
        }