public async Task <IActionResult> Create([Bind("Id,Name,CASNum,Manufacturer,HasMSDS,HealthHazard,FlammableHazard,ReactiveHazard,OtherHazard,CurrentQty,Unit,DateReceived,IsCheckedOut,DateCheckedOut,DateReturned,Location,Consumed,HazWaste,Disposed")] Inventory inventory) { //var autoEmail = new MimeMessage(); //autoEmail.From.Add(new MailboxAddress("*****@*****.**")); //autoEmail.To.Add(new MailboxAddress("*****@*****.**")); ////Lab instructor emails //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //autoEmail.Subject = "ELIMS Inventory Notification"; //autoEmail.Body = new TextPart("plain") //{ // Text = @"A new inventory entry has been entered on the ELIMS webpage. Please click this link to manage: https://elims.azurewebsites.net/inventories. Do not reply to this email." //}; //using (var client = new SmtpClient()) //{ // client.ServerCertificateValidationCallback = (s, c, h, e) => true; // client.Connect("smtp.gmail.com", 587, false); // client.Authenticate("*****@*****.**", "NAULabs123"); // client.Send(autoEmail); // client.Disconnect(true); //} if (ModelState.IsValid) { _context.Add(inventory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inventory)); }
public async Task <IActionResult> Create([Bind("Id,CFirstName,CLastName,UserId,CEmail,Topic,Message,ContactDate")] ContactForm contactForm) { //var autoEmail = new MimeMessage(); //autoEmail.From.Add(new MailboxAddress("*****@*****.**")); //autoEmail.To.Add(new MailboxAddress("*****@*****.**")); ////Lab instructor emails //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //autoEmail.Subject = "ELIMS Contact Notification"; //autoEmail.Body = new TextPart("plain") //{ // Text = @"You have recieved a contact information form from the ELIMS webpage. Please click this link to manage: https://elims.azurewebsites.net/ContactForms. Do not reply to this email." //}; //using (var client = new SmtpClient()) //{ // client.ServerCertificateValidationCallback = (s, c, h, e) => true; // client.Connect("smtp.gmail.com", 587, false); // client.Authenticate("*****@*****.**", "NAULabs123"); // client.Send(autoEmail); // client.Disconnect(true); //} if (ModelState.IsValid) { contactForm.OwnerID = _userManager.GetUserId(User); var isAuthorized = await _authorizationService.AuthorizeAsync(User, contactForm, ELIMSOperations.Create); // If not authorized if (!isAuthorized.Succeeded) { _context.Add(contactForm); await _context.SaveChangesAsync(); return(View("./Views/Home/Index.cshtml")); } _context.Add(contactForm); await _context.SaveChangesAsync(); return(View("./Views/Home/Index.cshtml")); } return(View("/Home/Index")); }
public async Task <IActionResult> Create([Bind("Id,Name,StartDate,EndDate")] BioRaft bioRaft) { if (ModelState.IsValid) { _context.Add(bioRaft); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bioRaft)); }
public async Task <IActionResult> Create([Bind("Id,UserId,StartDate,EndDate,RequestMade,FirstName,LastName,NAUEmail,ProjectName,ProjectObjective,ContactName,ContactID,Funding,SponsorName,SponsorPhone,SponsorEmail,Chemicals,MeetingTimes,GroupMembers,ProjectFile,Status,OwnerID")] Request request) { //var autoEmail = new MimeMessage(); //autoEmail.From.Add(new MailboxAddress("*****@*****.**")); //autoEmail.To.Add(new MailboxAddress("*****@*****.**")); ////Lab instructor emails //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //// autoEmail.To.Add(new MailboxAddress("*****@*****.**")); //autoEmail.Subject = "ELIMS Contact Notification"; //autoEmail.Body = new TextPart("plain") //{ // Text = @"A new request for lab usage has been submitted. Please click this link to manage: https://elims.azurewebsites.net/request. Do not reply to this email. Thank you!" //}; //using (var client = new SmtpClient()) //{ // client.ServerCertificateValidationCallback = (s, c, h, e) => true; // client.Connect("smtp.gmail.com", 587, false); // client.Authenticate("*****@*****.**", "NAULabs123"); // client.Send(autoEmail); // client.Disconnect(true); //} if (ModelState.IsValid) { request.OwnerID = _userManager.GetUserId(User); var isAuthorized = await _authorizationService.AuthorizeAsync(User, request, ELIMSOperations.Create); // If not authorized if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } _context.Add(request); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(request)); }