コード例 #1
0
        // GET: Assignment
        public ActionResult Index()
        {
            IList <AssignmentViewModel> assignmentsVm = new List <AssignmentViewModel>();

            foreach (Assignment a in _repository.GetAssignments())
            {
                assignmentsVm.Add(new AssignmentViewModel()
                {
                    AssignmentDetail = a,
                    SlotSelected     = _repository.GetSlotById(a.SlotId).Name,
                    TaskTypeSelected = _repository.GetTaskTypeById(a.TaskTypeId).Name,
                    PersonSelected   = _repository.GetPersonById(a.PersonId).Name,
                });
            }

            return(View(assignmentsVm));
        }
        // GET: Slot/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Slot slot = _repository.GetSlotById(id);

            if (slot == null)
            {
                return(HttpNotFound());
            }
            SlotViewModel slotVm = new SlotViewModel();

            slotVm.SlotDetail   = slot;
            slotVm.LocationName = _repository.GetLocationById(slot.LocationId).Name;
            return(View(slotVm));
        }