Я получаю следующую дату при возврате из углового кода 1/1/0001 в контроллере.дата отображается в правильном формате, как показано ниже
Мой фильтр, который находится в angularjs
myApp.filter("DateOfBirth", function () {
var re = /\/Date\(([0-9]*)\)\//;
return function (x) {
var m = x.match(re);
if (m)
return new Date(m);
else
return null;
};
});
Мой контроллер
public string Update_Data(Employee employee)
{
if(employee != null)
{
var employee_ = projectContext.Entry(employee);
Employee employeeObject = projectContext.Employees.Where(x => x.Employee_ID == employee.Employee_ID).FirstOrDefault();
employeeObject.First_Name = employee.First_Name;
employeeObject.Last_Name = employee.Last_Name;
employeeObject.Country_ID = employee.Country_ID;
employeeObject.State_ID = employee.State_ID;
employeeObject.City_ID = employee.City_ID;
employeeObject.Email = employee.Email;
employeeObject.Password = employee.Password;
employeeObject.Mobile = employee.Mobile;
employeeObject.DateOfBirth =Convert.ToDateTime( employee.DateOfBirth);
employeeObject.Age = employee.Age;
projectContext.SaveChanges();
return "Data Updated";
}
else
{
return "Please Check!!";
}
}
angularjs script
$scope.UpdateEmployee = function (Employee) {
document.getElementById("EmployeeID_").value = Employee.Employee_ID;
$scope.FirstName = Employee.First_Name;
$scope.LastName = Employee.Last_Name;
$scope.counter = Employee.Country_ID;
$scope.Counter = Employee.State_ID;
$scope.CityID = Employee.City_ID;
$scope.Email = Employee.Email;
$scope.Password = Employee.Password;
$scope.DateOfBirth = Employee.DateOfBirth;
$scope.Mobile = Employee.Mobile;
$scope.Age = Employee.Age;
document.getElementById("btnSave").setAttribute("value", "Update");
document.getElementById("btnSave").style.backgroundColor = "Yellow";
document.getElementById("spn").innerHTML = "Update Employee Information";
};
Я получаю это значение в контроллере mvc это