30
1
using System;
2
using System.ComponentModel.DataAnnotations;
3
using System.Collections.Generic;
4
5
namespace HelloWorldMvcApp
6
{
7
public class SampleViewModel
8
{
9
public List<CarouselItemModel> CarouselItemList
10
{
11
get;
12
set;
13
}
14
}
15
16
public class CarouselItemModel
17
{
18
public string Title
19
{
20
get;
21
set;
22
}
23
24
public string ImagePath
89
1
@model HelloWorldMvcApp.SampleViewModel
2
@{
3
Layout = null;
4
}
5
6
<!DOCTYPE html>
7
<html lang="en">
8
<head>
9
<meta charset="utf-8">
10
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
11
<title>Bootstrap 4 Carousel</title>
12
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
13
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
14
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
15
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
16
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
17
<style>
18
.carousel{
19
background: #2f4357;
20
margin-top: 20px;
21
}
22
.carousel-item{
23
text-align: center;
24
min-height: 280px; /* Prevent carousel from being distorted if for some reason image doesn't load */
25
1
using System;
2
using System.Web.Mvc;
3
using System.Collections.Generic;
4
5
namespace HelloWorldMvcApp
6
{
7
public class HomeController : Controller
8
{
9
[HttpGet]
10
public ActionResult Index()
11
{
12
var model = new SampleViewModel();
13
model.CarouselItemList = new List<CarouselItemModel>()
14
{new CarouselItemModel()
15
{Title = "Title 1", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+1"}, new CarouselItemModel()
16
{Title = "Title 2", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+2"}, new CarouselItemModel()
17
{Title = "Title 3", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+3"}, new CarouselItemModel()
18
{Title = "Title 4", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+4"}, new CarouselItemModel()
19
{Title = "Title 5", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+5"}, new CarouselItemModel()
20
{Title = "Title 6", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+6"}, new CarouselItemModel()
21
{Title = "Title 7", ImagePath = "https://dummyimage.com/300x200/000000/0011ff&text=Slide+7"} };
22
return View(model);
23
}
24
}
25
}
Grok AI Generated Code for GetInnermostString function