Skip to content

Instantly share code, notes, and snippets.

View bpesquet's full-sized avatar

Baptiste Pesquet bpesquet

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using MvcUniversity.Data;
using MvcUniversity.Models;
namespace MvcUniversity.Controllers
@model MvcUniversity.Models.Instructor
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Instructor</h4>
<hr />
// Add students
Student carson = new Student
{
FirstName = "Alexander",
LastName = "Carson",
EnrollmentDate = DateTime.Parse("2016-09-01"),
};
Student alonso = new Student
{
FirstName = "Meredith",
using MvcUniversity.Data;
namespace MvcUniversity.Models;
public class SeedData
{
public static void Init()
{
using (var context = new UniversityContext())
{
const rootEndpoint = "https://www.thecocktaildb.com/api/json/v1/1";
// Model class for a cocktail
export class Cocktail {
constructor(id, name, image, instructions) {
this.id = id;
this.name = name;
this.image = image;
this.thumbnail = image + "/preview";
this.instructions = instructions;