小编Kah*_*Lee的帖子

将图像添加到 ASP.net core

我想添加图像作为模型类的一部分并将其显示在索引视图上。我在将图像分类为 byte[] 或 iFormFile 时遇到问题。

这就是我想要实现的目标

  1. 创建一个页面来插入员工列表

  2. 在索引页面中,能够列出员工并查看他们的图像。

这是模型。

员工.cs

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;

namespace MvcMovie.Models
{
  public class Employee
  {
    public int ID { get; set; }
    [Required]
    public string FirstName { get; set; }
    [Required]
    public string LastName { get; set; }
    [Required]
    public string Nationality { get; set; }
    [Required]
    public string NRIC { get; set; }
    [Required]
    public string StaffID { get; set; }
    [Required]
    public int AccessRights …
Run Code Online (Sandbox Code Playgroud)

c# image asp.net-core-mvc asp.net-core

3
推荐指数
1
解决办法
3万
查看次数

标签 统计

asp.net-core ×1

asp.net-core-mvc ×1

c# ×1

image ×1