Пример #1
0
        public async Task <ActionResult> Edit(string id)
        {
            var permissionGroups = await permissionsGroupService.GetPermissionGroupById(id);

            if (permissionGroups == null)
            {
                return(NotFound());
            }
            var    model            = mapper.Map <PermissionsGroupsViewModel>(permissionGroups);
            string spletedStartDate = "";
            string spletedEndDate   = "";

            if (model.StartDate != null)
            {
                var gregorianDate = ConvertDatetime.ConvertDateCalendar(((DateTime)model.StartDate).AddDays(1), "Gregorian", "en-US");
                spletedStartDate = gregorianDate.Split()[0];
            }
            if (model.EndDate != null)
            {
                var gregorianDate = ConvertDatetime.ConvertDateCalendar(((DateTime)model.EndDate).AddDays(1), "Gregorian", "en-US");
                spletedEndDate = gregorianDate.Split()[0];
            }

            model.Ger_StartDate_string = spletedStartDate;
            model.Ger_EndDate_string   = spletedEndDate;
            return(View(model));
        }
Пример #2
0
        public async Task <ActionResult> Edit(Guid id)
        {
            var admin = await adminsService.GetAdminById(id);

            if (admin == null)
            {
                return(NotFound());
            }
            string spletedGregorianDate     = "";
            string spletedActivationEndDate = "";

            if (admin.ActivationStartDate != null)
            {
                var gregorianDate = ConvertDatetime.ConvertDateCalendar(admin.ActivationStartDate.AddDays(1), "Gregorian", "en-US");
                spletedGregorianDate = gregorianDate.Split()[0];
            }
            if (admin.ActivationEndDate != null)
            {
                var gregorianDate = ConvertDatetime.ConvertDateCalendar(((DateTime)admin.ActivationEndDate).AddDays(1), "Gregorian", "en-US");
                spletedActivationEndDate = gregorianDate.Split()[0];
            }
            var model = new AdminViewModel()
            {
                Id                             = admin.Id,
                FirstName                      = admin.FirstName,
                SecondName                     = admin.SecondName,
                ThirdName                      = admin.ThirdName,
                LastName                       = admin.LastName,
                Title                          = admin.Title,
                NationalId                     = admin.NationalId,
                MobileNumber                   = admin.MobileNumber,
                Email                          = admin.Email,
                CanApprove                     = admin.CanApprove,
                IsActive                       = admin.IsActive,
                ActivationStartDate            = admin.ActivationStartDate,
                ActivationEndDate              = admin.ActivationEndDate,
                EmplyeeNo                      = admin.EmplyeeNo,
                RootPath                       = $"{Constants.AdminsUploadDirectory.Replace('/', '\\')}",
                ProfileImage                   = admin.ProfileImage,
                SignatureImage                 = admin.SignatureImage,
                IsManager                      = admin.IsManager,
                DepartmentCode                 = admin.DepartmentCode,
                SelectedRolesIds               = admin.Roles.Select(i => i.RoleId).ToList(),
                Ger_ActivationStartDate_string = spletedGregorianDate,
                Ger_ActivationEndDate_string   = spletedActivationEndDate
            };
            await model.FillRolesList(adminsService);

            return(View(model));
        }