2
Answers

How to set Datetime as current date time in MVC

Photo of Mark Tabor

Mark Tabor

7y
278
1
I have a class as 
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AdminLteMvc.Models
{
using System;
using System.Collections.Generic;
public partial class Designation
{
public Designation()
{
Date_Created = DateTime.Now;
Date_Modifed = DateTime.Now;
}
}
public int Design_Id { get; set; }
public string Design_Name { get; set; }
public Nullable<bool> IsActive { get; set; }
 public Nullable<DateTime> Date_Created { get ; set ; }
public Nullable<DateTime> Date_Modifed { get ; set ; }
}
}
I want to set datetime as current datetime instead of taking them from users i have also write a constructor and initilizing them in that but still null they are nullable in db as well

Answers (2)

0
Photo of Ramesh Palanivel
NA 9.5k 138.7k 8y
Hi trin,
 
Try this link, it may help you , they explained detaily about custom action invoker..
 
http://techfunda.com/howto/925/controller-action-invoker 
Accepted
0
Photo of tri_inn
NA 1.2k 42.6k 8y
i checked the link here you mention but that is very beggining kind of write up. i am looking for few real life scenario where people use custom action invoker.
 
can you tell me few real life scenario where people get their job done by  custom action invoker ?
http://techfunda.com/howto/925/controller-action-invoker
http://techfunda.com/howto/926/action-invoker
http://techfunda.com/howto/925/controller-action-invoker
http://techfunda.com/howto/926/action-invoker
 
thanks