-Annie-

11.AddCakes

Feb 2nd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. namespace _11.AddCakes
  2. {
  3.     using System;
  4.     using System.IO;
  5.  
  6.     public static class AddCakes
  7.     {
  8.         public static void Main()
  9.         {
  10.             Console.WriteLine("Content-Type: text/html\r\n");
  11.             string htmlContent = File.ReadAllText("../www/addcakes.html");
  12.             Console.WriteLine(htmlContent);
  13.             string post = Console.ReadLine();
  14.             string[] variables = post.Split('&');
  15.             string cakeName = variables[0].Split('=')[1];
  16.             string cakePrice = variables[1].Split('=')[1];
  17.             File.AppendAllText("database.csv", $"{cakeName}, {cakePrice}" + Environment.NewLine);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment