Beispiel #1
0
        public ActionResult Create(ActivityTaskViewModel activityTaskViewModel)
        {
            bool isSuperAdmin   = User.IsInAnyRoles("SuperAdmin");
            var  organisationId = UserOrganisationId;
            var  personnelId    = UserPersonnelId;
            var  centreId       = UserCentreId;

            if (ModelState.IsValid)
            {
                activityTaskViewModel.ActivityTask.OrganisationId = organisationId;
                activityTaskViewModel.ActivityTask.ActivityId     = activityTaskViewModel.ActivityTask.Activity.ActivityId;
                activityTaskViewModel.ActivityTask = NidanBusinessService.CreateActivityTask(organisationId, personnelId, centreId, activityTaskViewModel.ActivityTask);
                return(RedirectToAction("Create", "ActivityTask", new { id = activityTaskViewModel.ActivityTask.ActivityId }));
            }
            var centres = isSuperAdmin || centreId == 7 ? NidanBusinessService.RetrieveCentres(organisationId, e => true) : NidanBusinessService.RetrieveCentres(organisationId, e => e.CentreId == centreId);

            activityTaskViewModel.Centres      = new SelectList(centres);
            activityTaskViewModel.AssignToList = new SelectList(NidanBusinessService.RetrieveActivityAssignPersonnels(organisationId, centreId, activityTaskViewModel.ActivityTask.Activity.ActivityAssigneeGroupId).Items.Select(e => e.Personnel).ToList());
            return(View(activityTaskViewModel));
        }