unable to cast object of type system.string to system.decimal

SathyanarayananAV 1 Reputation point

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
public class Employee
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; }  



A set of technologies in the .NET Framework for building web applications and XML web services.
4,249 questions
{count} votes