Checking if the value of type DateTime is null in view and showing blank if null

后端 未结 4 860
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 23:46

From my controller I have passed value module to view

    public ActionResult Details(long id, string owner)
    {
        var module = _ownedModuleRepositor         


        
4条回答
  •  渐次进展
    2020-12-21 00:24

    you can use C# null coalescing operator:

    @(Model.End?.ToString("dd/MM/yyyy") ?? "Date is Empty")
    

提交回复
热议问题