예제 #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound());
            }
            var Batch = BatchRepo.Find(id);

            if (Batch == null)
            {
                return(HttpNotFound());
            }
            var TrainerList = TrainerRepo.GetAll();

            ViewBag.Trainers = new SelectList(TrainerList, "Id", "Name", Batch.TrainerId);
            var vmBatches = new Models.vmBatch
            {
                BatchDates = string.Join(",", Batch.BatchDates.Select(p => p.BatchDate.ToString("MM/dd/yyyy"))),
                Id         = Batch.Id,
                Name       = Batch.Name,
            };

            return(View(vmBatches));
        }