I am posting a JavaScript date object from the client side and receiving it in the C# controller action. In the C# controller action the object is mapped to a C# DateTime
object.
But the DateTime object is not getting the exact value from javascript date object.
Its showing DateTime's min value, i.e.
01-01-0001 12:00:00 AM
- Here is my client side breakpoint screen-shot:
- Here is my C# controller action screen-shot:
Here is my ViewModel class:
public class CompanyLaraHistoryViewModel
{
public int HistoryId { get; set; }
public int CompanyId { get; set; }
[Display(Name = "Company Name")]
public string CompanyName { get; set; }
[Display(Name = "LARA")]
public byte LaraId { get; set; }
public LARA Lara { get; set; }
[Display(Name = "Changed Date")]
public DateTime ChangedDate { get; set; }
public int ChangedById { get; set; }
[Display(Name = "Comments")]
public string Comments { get; set; }
public bool IsDeleted { get; set; }
}
What can be the possible reason for this? Is it that js date objects cannot be mapped to c# datetime objects?
Can anyone give me a solution?
Aucun commentaire:
Enregistrer un commentaire