示例#1
0
        public ActionResult Create(EventViewModel eventViewModel)
        {
            bool isSuperAdmin   = User.IsInAnyRoles("SuperAdmin");
            var  organisationId = UserOrganisationId;

            if (ModelState.IsValid)
            {
                eventViewModel.Event.OrganisationId = UserOrganisationId;
                //eventViewModel.Event.CentreId = UserCentreId;
                eventViewModel.Event.CreatedDateTime = _today;
                eventViewModel.Event.CreatedBy       = UserPersonnelId;
                eventViewModel.Event = NidanBusinessService.CreateEvent(UserOrganisationId, eventViewModel.Event);
                return(RedirectToAction("Index"));
            }
            eventViewModel.Centres = new SelectList(NidanBusinessService.RetrieveCentres(organisationId, e => isSuperAdmin || e.CentreId == UserCentreId).ToList());
            return(View(eventViewModel));
        }