public async Task <IActionResult> Create([Bind("ID,Title,Text,ImageUrl,Author")] Content content) { if (ModelState.IsValid) { _context.Add(content); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(content)); }
public async Task <IActionResult> Create([Bind("LangID,LangTag")] Language language) { if (ModelState.IsValid) { _context.Add(language); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(language)); }
public async Task <IActionResult> Create([Bind("OrganizationID,OrganizationName")] Organization organization) { if (ModelState.IsValid) { _context.Add(organization); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(organization)); }
public async Task <IActionResult> Create([Bind("Employee_ProfileID,Name,Job,Profile_PhotoPath,Region,CountryOrProvince")] Employee_Profile employee_Profile) { if (ModelState.IsValid) { _context.Add(employee_Profile); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee_Profile)); }
public async Task <IActionResult> Create([Bind("RecipeID,Name")] Recipe recipe) { if (ModelState.IsValid) { _context.Add(recipe); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(recipe)); }
public async Task <IActionResult> Create([Bind("ArticleNumber,Name,Description,Contents")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("BranchID,Name")] Branch_Category branch_Category) { if (ModelState.IsValid) { _context.Add(branch_Category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(branch_Category)); }
public async Task <IActionResult> Create([Bind("PhotoID,PhotoPath")] Photo photo) { if (ModelState.IsValid) { _context.Add(photo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(photo)); }
public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Description,Age,IsDead")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(person)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,Message")] Post post) { if (ModelState.IsValid) { _context.Add(post); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(post)); }
public async Task <IActionResult> Create([Bind("SubscriberID,Email")] Subscriber subscriber) { if (ModelState.IsValid) { _context.Add(subscriber); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(subscriber)); }
public async Task <IActionResult> Create([Bind("CategoryID,Category")] News_Category news_Category) { if (ModelState.IsValid) { _context.Add(news_Category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(news_Category)); }
public async Task <IActionResult> Create([Bind("Number,ProfileID")] Employee_Profile_Phone_Number employee_Profile_Phone_Number) { if (ModelState.IsValid) { _context.Add(employee_Profile_Phone_Number); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee_Profile_Phone_Number)); }
public async Task <IActionResult> Create([Bind("TextID,Content,WebsitePageID,LangID")] Text text) { if (ModelState.IsValid) { _context.Add(text); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LangID"] = new SelectList(_context.Languages, "LangID", "LangTag", text.LangID); return(View(text)); }
public async Task <IActionResult> Create([Bind("TypeID,Name,BranchID")] Type_Category type_Category) { if (ModelState.IsValid) { _context.Add(type_Category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BranchID"] = new SelectList(_context.Branch_Categories, "BranchID", "Name", type_Category.BranchID); return(View(type_Category)); }
public async Task <IActionResult> Create([Bind("NewsID,Event_Date,Last_Modified_Date,Title,CategoryID")] News_Item news_Item) { if (ModelState.IsValid) { _context.Add(news_Item); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.News_Categories, "CategoryID", "CategoryID", news_Item.CategoryID); return(View(news_Item)); }
public async Task <IActionResult> Create([Bind("CategoryID,Name,TypeID")] Normal_Category normal_Category) { if (ModelState.IsValid) { _context.Add(normal_Category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TypeID"] = new SelectList(_context.Type_Categories, "TypeID", "Name", normal_Category.TypeID); return(View(normal_Category)); }
public async Task <IActionResult> Create([Bind("DetailID,ProductDetails,ArticleNumber")] Product_Details product_Details) { if (ModelState.IsValid) { _context.Add(product_Details); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArticleNumber"] = new SelectList(_context.Products, "ArticleNumber", "Name", product_Details.ArticleNumber); return(View(product_Details)); }
public async Task <IActionResult> Create([Bind("UserID,FirstName,LastName,OrganizationID,Email")] User user) { if (ModelState.IsValid) { Organization o = _context.Organization.Find(user.OrganizationID); System.Diagnostics.Debug.WriteLine($"************{o.OrganizationID} {o.OrganizationName}*****************\n"); System.Diagnostics.Debug.WriteLine($"************{o.Users} {o.Users.Count}*****************\n"); _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrganizationID"] = new SelectList(_context.Organization, "OrganizationID", "OrganizationID", user.OrganizationID); return(View(user)); }
public async Task <IActionResult> Create([Bind("ID,OrganizationID,ComplaintText")] Complaint complaint) { if (ModelState.IsValid) { System.Diagnostics.Debug.WriteLine("************HUIASASAASASASA*****************\n"); SqlConnection sqlConnection1 = new SqlConnection("Server=(localdb)\\mssqllocaldb;Database=NewDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandText = $"SELECT Email FROM [User] WHERE OrganizationID = {complaint.OrganizationID}"; cmd.CommandType = CommandType.Text; cmd.Connection = sqlConnection1; sqlConnection1.Open(); reader = cmd.ExecuteReader(); // Data is accessible through the DataReader object here. while (reader.Read()) { System.Diagnostics.Debug.WriteLine(String.Format("{0}", reader[0])); System.Diagnostics.Debug.WriteLine("************Message Sent*****************\n"); MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(String.Format("{0}", reader[0])); mail.Subject = "Complaint Mail"; mail.Body = complaint.ComplaintText; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("bekzhan.kaspakov", "watsamatsate98"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); Console.WriteLine("Message Sent\n"); } sqlConnection1.Close(); //{ // System.Diagnostics.Debug.WriteLine("************Message Sent*****************\n"); // MailMessage mail = new MailMessage(); // SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); // mail.From = new MailAddress("*****@*****.**"); // mail.To.Add(u.Email); // mail.Subject = "Test Mail"; // mail.Body = "This is for testing SMTP mail from GMAIL"; // SmtpServer.Port = 587; // SmtpServer.Credentials = new System.Net.NetworkCredential("bekzhan.kaspakov", "watsamatsate98"); // SmtpServer.EnableSsl = true; // SmtpServer.Send(mail); // Console.WriteLine("Message Sent\n"); //} _context.Add(complaint); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrganizationID"] = new SelectList(_context.Organization, "OrganizationID", "OrganizationID", complaint.OrganizationID); return(View(complaint)); }