public async Task <IActionResult> Create([Bind("UserId,Name,LastName,Age,Email,Password,Country,Province,IsAdmin")] Users users) { if (ModelState.IsValid) { _context.Add(users); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(users)); }
public async Task <IActionResult> Create([Bind("StrainId,Sname,Thc,Cbd,Terpenes,Pic,Effects")] StrainInfo strainInfo) { if (ModelState.IsValid) { _context.Add(strainInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(strainInfo)); }
public async Task <IActionResult> Create([Bind("ReviewId,StrainId,UserId,ReviewText,ReviewRate")] Review review) { if (ModelState.IsValid) { _context.Add(review); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StrainId"] = new SelectList(_context.StrainInfo, "StrainId", "StrainId", review.StrainId); ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserId", review.UserId); return(View(review)); }
public async Task <IActionResult> Create([Bind("ID,Nombre,APaterno,AMaterno,Curp,FechaNac,FKComCatSexo,FKComCatEscolaridad")] ComPersona comPersona) { try { if (ModelState.IsValid) { _context.Add(comPersona); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FKComCatEscolaridad"] = new SelectList(_context.ComCatEscolaridad, "ID", "Nombre", comPersona.FKComCatEscolaridad); ViewData["FKComCatSexo"] = new SelectList(_context.ComCatSexo, "ID", "Nombre", comPersona.FKComCatSexo); return(View(comPersona)); } catch (Exception ex) { var message = new MimeMessage(); message.From.Add(new MailboxAddress("Send", "*****@*****.**")); message.To.Add(new MailboxAddress("Reception", "*****@*****.**")); message.Subject = "Exceptions"; message.Body = new TextPart("plain") { Text = "Excepción encontrada: " + ex.StackTrace }; using (var client = new SmtpClient()) { client.Connect("smtp.gmail.com", 587, false); client.Authenticate("*****@*****.**", "PruebaExcepciones123"); client.Send(message); client.Disconnect(true); } return(null); } }