unable to cast object of type system.string to system.decimal
I am new to asp.net MVC core programming. I have got with previous experience in asp.net web pages. Can somebody help me regarding this.
This is the EmployeeController code:-
using BusinessLayer.Models;
using Microsoft.AspNetCore.Mvc;
namespace ERP.Controllers
{
public class EmployeeController : Controller
{
private readonly EmployeeDBContext _db;
public EmployeeController(EmployeeDBContext db)
{
this._db = db;
}
public IActionResult Index()
{
List<Employee> emps = _db.Employees.ToList();
return View(emps);
}
}
}
Employee Model:-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BusinessLayer.Models
{
[Table("Employees")]
public class Employee
{
[Key]
public int Eno { get; set; }
public string Ename { get; set; }
public decimal Salary {get; set; }
public string Job { get; set; }
public string Dname { get; set; }
}
}