I have model with id
and date
. Then I make it angular.toJson
and send to server. The problem is in that: if my date is empty, model's date field on server shows as {1/1/0001 12:00:00 AM} but not null. How to solve this? I need null
.
Here is angularjs controller where my function calls
$scope.filterModel = function (filter) {
postService.getFilteredByUserId($scope.bindModel, angular.toJson(filter));
};
Here is my server function that gets this model
[HttpPost]
public IEnumerable<TimesheetModel> FilterModel(TimesheetFilterModel filter)
{
return TimesheetService.FilterTimesheetListByFilter(filter);
}
Here is model:
public class TimesheetFilterModel
{
public int UserId { get; set; }
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public int TicketType { get; set; }
}