public async Task <IActionResult> Create([Bind("Ideventtype,Description")] Eventtype eventtype)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventtype);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(eventtype));
        }
        public async Task <IActionResult> Create([Bind("Idregister,Isvalid,Iduser")] Register register)
        {
            if (ModelState.IsValid)
            {
                _context.Add(register);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Iduser"] = new SelectList(_context.User, "Iduser", "Email", register.Iduser);
            return(View(register));
        }
        public async Task <IActionResult> Create([Bind("Iddocument,Description,Blob,Idregister")] Documents documents)
        {
            if (ModelState.IsValid)
            {
                _context.Add(documents);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idregister"] = new SelectList(_context.Register, "Idregister", "Idregister", documents.Idregister);
            return(View(documents));
        }
        public async Task <IActionResult> Create([Bind("Ideventschedule,Idevent,Iduser,Datestart,Dateend")] Eventschedule eventschedule)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventschedule);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Idevent"] = new SelectList(_context.Event, "Idevent", "Description", eventschedule.Idevent);
            ViewData["Iduser"]  = new SelectList(_context.User, "Iduser", "Email", eventschedule.Iduser);
            return(View(eventschedule));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Ideventregister,Ideventschedule,Iduser,Evaluation,Comments")] Eventregister eventregister)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventregister);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ideventschedule"] = new SelectList(_context.Eventschedule, "Ideventschedule", "Ideventschedule", eventregister.Ideventschedule);
            ViewData["Iduser"]          = new SelectList(_context.User, "Iduser", "Email", eventregister.Iduser);
            return(View(eventregister));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("Idevent,Description,Grade,Ideventtype")] Event @event)
        {
            if (ModelState.IsValid)
            {
                @event.Idevent = Guid.NewGuid();
                _context.Add(@event);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ideventtype"] = new SelectList(_context.Eventtype, "Ideventtype", "Description", @event.Ideventtype);
            return(View(@event));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("Iduser,Name,Lastname,Surname,Idusertype,Email,Password")] User user, DateTime dob, int idgender, int idstate, string city, List <IFormFile> files)
        {
            user.Idusertype = 1;
            if (ModelState.IsValid)
            {
                SHA256 mySHA256 = SHA256.Create();
                user.Userinfo = new Userinfo
                {
                    Idgender = idgender,
                    Idstate  = idstate,
                    City     = city,
                    Dob      = dob
                };
                user.Password = ShaHelper.ComputeSha256Hash(user.Password);
                _context.Add(user);
                await _context.SaveChangesAsync();

                List <Documents> Documents = new List <Documents>();
                foreach (var item in files)
                {
                    Documents documents = new Documents();
                    using (var memoryStream = new MemoryStream())
                    {
                        item.CopyTo(memoryStream);
                        documents.Blob        = memoryStream.ToArray();
                        documents.Description = item.FileName;
                    }
                    Documents.Add(documents);
                }
                var register = new Register
                {
                    Isvalid   = false,
                    Iduser    = user.Iduser,
                    Documents = Documents
                };
                _context.Add(register);
                await _context.SaveChangesAsync();

                return(Redirect("/Register"));
            }
            ViewData["Idusertype"] = new SelectList(_context.Usertype, "Idusertype", "Description", user.Idusertype);
            return(View(user));
        }