Skip to content

Instantly share code, notes, and snippets.

View guntidheerajkumar's full-sized avatar
💭
Happy

Dheeraj Kumar Gunti guntidheerajkumar

💭
Happy
View GitHub Profile
setInterval(function updateClock() {
var currentTime = new Date();
var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;
// Choose either "AM" or "PM" as appropriate
public class MyCustomEngine : RazorViewEngine
{
public MyCustomEngine()
{
base.AreaViewLocationFormats = new string[] { "~/Areas/{2}/Views/{1}/{0}.cshtml", "~/Areas/{2}/Views/Shared/{0}.cshtml" };
base.AreaMasterLocationFormats = new string[] { "~/Areas/{2}/Views/{1}/{0}.cshtml", "~/Areas/{2}/Views/Shared/{0}.cshtml" };
base.AreaPartialViewLocationFormats = new string[] { "~/Areas/{2}/Views/{1}/{0}.cshtml", "~/Areas/{2}/Views/Shared/{0}.cshtml" };
base.ViewLocationFormats = new string[] { "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
base.MasterLocationFormats = new string[] { "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
base.PartialViewLocationFormats = new string[] { "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" };
//Clearing all the View Engines
ViewEngines.Engines.Clear();
//Adding Razor View Engine to our application
ViewEngines.Engines.Add(new RazorViewEngine());
public class EmployeeData
{
public int EmpId { get; set; }
public string EmpName { get; set; }
public DateTime DOB { get; set; }
}
public interface IEmployee
{
List<EmployeeData> GetAllEmployees();
EmployeeData GetEmployeeById(int EmpId);
bool InsertEmployee(EmployeeData emp);
bool UpdateEmployee(EmployeeData emp);
private static IUnityContainer BuildUnityContainer()
{
var container = new UnityContainer();
container.RegisterType<IEmployee, Employee>();
RegisterTypes(container);
return container;
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
UnityDependency.Initialise();
}
private IEmployee employee;
public EmployeeController(IEmployee employee)
{
this.employee = employee;
}
public ActionResult Index()
{
return View(employee.GetAllEmployees());
private IEmployee _employee;
public IEmployee EmployeeDI
{
get { return _employee; }
set { _employee = value; }
}
private IEmployee employee;
public EmployeeController(IEmployee employee)
{
this.employee = employee;
}