I am using ASP.NET MVC C # with jQuery KnockoutJs HTML CSS interface.
I have a modal contact form on my HTML page. The idea is that if I create a new contact, the modal form appears with empty values, including an empty hidden id field.
If I edit the contact, then the modal form will appear with the fields filled in, including this hidden id field.
In my controller, I intend to do this:
public JsonResult Contact(string values)
{
var contact = JsonConvert.DeserializeObject<contact>(values);
if (contact.Id.Equals(Guid.Empty))
{
} else
{
}
}
However, I get an error can't convert "" to type Guid
How to get around this with NewtonSoft Json, I looked here in Custom JsonConverter and it seems to be going along the right lines, however I'm not sure where to go with this.
source