Dimitar46

Import.cshtml - View

Apr 10th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. @model Project
  2. @{
  3.     ViewData["Title"] = "Import Projects";
  4. }
  5. @if (!ViewData.ModelState.IsValid)
  6. {
  7.     <div class="alert alert-danger" style="margin-top:10px;">
  8.         <ul>
  9.             @foreach (var modelState in ViewData.ModelState.Values)
  10.             {
  11.                 foreach (var error in modelState.Errors)
  12.                 {
  13.                     <li>@error.ErrorMessage</li>
  14.                 }
  15.             }
  16.         </ul>
  17.     </div>
  18. }
  19. <form asp-controller="Project" asp-action="Import" method="post" enctype="multipart/form-data">
  20.     <div class="form-group" style="margin-top:10px;">
  21.         <label for="file">Select File:</label>
  22.         <input type="file" class="form-control-file" id="file" name="file">
  23.  
  24.     </div>
  25.     <button type="submit" class="btn btn-primary" style="margin-top:10px;">Upload File</button>
  26. </form>
  27.  
  28. <h1>Import Instructions</h1>
  29. <p>To import projects, please upload a JSON file containing project data.</p>
  30.  
  31. <h3>JSON Format</h3>
  32. <p>The JSON file should have the following structure:</p>
  33. <pre>
  34. {
  35.   "projects": [
  36.     {
  37.       "title": "Project 1",
  38.       "description": "Description of Project 1",
  39.       "author": "John Doe",
  40.       "programmingLanguage": "C#",
  41.       "completionTime": 50,
  42.       "status": "Completed"
  43.     },
  44.     {
  45.       "title": "Project 2",
  46.       "description": "Description of Project 2",
  47.       "author": "Jane Smith",
  48.       "programmingLanguage": "Java",
  49.       "completionTime": 120,
  50.       "status": "Completed"
  51.     },
  52.     {
  53.       "title": "Project 3",
  54.       "description": "Description of Project 3",
  55.       "author": "Alice Johnson",
  56.       "programmingLanguage": "Python",
  57.       "completionTime": 80,
  58.       "status": "Completed"
  59.     }
  60.   ]
  61. }
  62. </pre>
  63.  
  64.  
  65.  
  66.  
Add Comment
Please, Sign In to add comment