示例#1
0
        public async Task <IActionResult> EditCell(CellEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var cell = await repository.GetEvent(model.Id) as Cell;

                cell.Date        = model.Date;
                cell.Convertions = model.Convertions;
                repository.Update(cell);
                return(RedirectToAction("list", "event"));
            }
            return(View("EditBaptism", model));
        }
示例#2
0
        public async Task <ViewResult> Edit(int Id)
        {
            var occasion = await repository.GetEvent(Id);

            if (occasion == null)
            {
                ViewBag.ErrorMessage = $"Evento com Id: {Id} não pode ser encontrado";
                return(View("NotFound"));
            }
            switch (occasion.EventType)
            {
            case EventType.CULTO:
                var editCulViewModel = new EditCultViewModel(occasion as Cult);
                return(View("Editcult", editCulViewModel));

            case EventType.ESCOLA_DOMINICAL:
                var schoolmodel = new EditSundaySchoolViewModel(occasion as SundaySchool);
                schoolmodel = await ConfigureLists(schoolmodel, schoolmodel.Id) as EditSundaySchoolViewModel;

                return(View("EditSundaySchool", schoolmodel));

            case EventType.REUNIÃO:
                var reunionmodel = new ReunionEditViewModel(occasion as Reunion);
                reunionmodel = await ConfigureLists(reunionmodel, reunionmodel.Id) as ReunionEditViewModel;

                return(View("EditReunion", reunionmodel));

            case EventType.BATISMO:
                var baptismmodel = new BaptismEditViewModel(occasion as Baptism);
                baptismmodel = await ConfigureLists(baptismmodel, baptismmodel.Id) as BaptismEditViewModel;

                return(View("EditBaptism", baptismmodel));

            case EventType.CÉLULA:
                var cellmodel = new CellEditViewModel(occasion as Cell);
                return(View("EditCell", cellmodel));


            default:
                return(View());
            }
        }