public ActionResult RosterDetails(int id) { int CompanyId = (int)(Session["CompanyId"]); RosterViewModel RosterDetails = new RosterViewModel(); if (id != 0) { var c = _IRosterService.GetRosterDetails(id); RosterDetails.Roster = new RosterListViewModel { Id = c.Id, EndDate = c.EndDate == null?DateTime.Now:c.EndDate, FinishTime = c.FinishTime == null?DateTime.Now:c.FinishTime, StartDate = c.StartDate == null?DateTime.Now:c.StartDate, StartTime = c.StartTime == null?DateTime.Now:c.StartTime, UserId = c.UserId }; } else { RosterDetails.Roster = new RosterListViewModel { Id = 0, EndDate = DateTime.Now, FinishTime = DateTime.Now, StartDate = DateTime.Now, StartTime = DateTime.Now, UserId = null }; } var y = _commonservice.GetUserSelectList(CompanyId); RosterDetails.UserList = y.UserList.Select(t => new SelectListItems { id = t.Id, text = t.Text }).ToList(); return(View("RosterDetails", RosterDetails)); }