Пример #1
0
        // GET: Class/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            EditViewBagParams();
            try
            {
                if (id <= 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                var permission = await _permissionyQuery.GetAsync(id);

                if (permission == null)
                {
                    return(HttpNotFound());
                }
                var permissionVm = new PermissionViewModel()
                {
                    PermissionName = permission.Name,
                    PermissionId   = permission.Id,
                    PermissionCode = permission.Code
                };

                return(PartialView("_PartialAddEdit", permissionVm));
            }
            catch (Exception exp)
            {
                _log.Error(exp);
                return(View("Error"));
            }
        }
Пример #2
0
        public async Task <ActionResult> Edit(int id)
        {
            try
            {
                EditViewBagParams();
                if (id <= 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ApplicationUser userModel = await _applicationUserQuery.GetAsync(id);

                UserViewModel userdataModel = UserViewModel.EntityToModels(userModel);
                if (userModel == null)
                {
                    return(HttpNotFound());
                }
                userdataModel.Roles        = _utility.GetRoles();
                userdataModel.SelectedRole = _applicationUserQuery.StoreprocedureQueryFor <UserRoleInfo>(AppConstant.FetchUserRoleByUserId + " @UserId", new SqlParameter("UserId", id)).Select(c => c.Name).ToList();
                return(PartialView("_PartialAddEdit", userdataModel));
            }
            catch (Exception exp)
            {
                _log.Error(exp);
                return(View("Error"));
            }
        }
Пример #3
0
        // GET: Class/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            EditViewBagParams();
            try
            {
                if (id <= 0)
                {
                    return(new BadRequestResult());
                }
                var permission = await _permissionyQuery.GetAsync(id);

                if (permission == null)
                {
                    return(NotFound($"Unable to load permission with ID '{id}'."));
                }
                var permissionVm = _mapper.Map <PermissionViewModel>(permission);

                return(PartialView("_PartialAddEdit", permissionVm));
            }
            catch (Exception exp)
            {
                _log.LogError(exp.Message);
                return(View("Error"));
            }
        }
        public async Task <ActionResult> Edit(int id)
        {
            EditViewBagParams();
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmailTemplate emailTemplate = await _EmailTemplateQuery.GetAsync(id);

            var emailTokenModel = _EmailTokenQuery.GetAllList(c => c.EmailCode == emailTemplate.Code).ToList();

            try
            {
                var model = new EmailViewModel()
                {
                    EmailID      = emailTemplate.Id,
                    EmailSubject = emailTemplate.Name,
                    EmailCode    = emailTemplate.Code,
                    EmailText    = emailTemplate.Body,
                    EmailToken   = emailTokenModel
                };
                return(PartialView("_PartialAddEdit", model));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                _log.Info(ex);
                return(View("Error"));
            }
        }
Пример #5
0
        public async Task <ActionResult> Edit(int id)
        {
            EditViewBagParams();

            if (id <= 0)
            {
                return(new BadRequestResult());
            }
            EmailTemplate emailTemplate = await _EmailTemplateQuery.GetAsync(id);

            if (emailTemplate == null)
            {
                return(NotFound($"Unable to load permission with ID '{id}'."));
            }
            var emailTokenModel = _EmailTokenQuery.GetAllList(c => c.EmailCode == emailTemplate.Code).ToList();

            try
            {
                var model = new EmailViewModel()
                {
                    EmailID      = emailTemplate.Id,
                    EmailSubject = emailTemplate.Name,
                    EmailCode    = emailTemplate.Code,
                    EmailText    = emailTemplate.Body,
                    EmailToken   = emailTokenModel
                };
                return(PartialView("_PartialAddEdit", model));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                _log.LogError(ex.Message);
                return(View("Error"));
            }
        }
Пример #6
0
        public async Task <ActionResult> Edit(int id)
        {
            EventViewModel eventVm = new EventViewModel();

            eventVm.Artists = _utility.GetAllArtists();
            try
            {
                EditViewBagParams();
                if (id <= 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Event eventModel = await _EventQuery.GetAsync(id);

                if (eventModel == null)
                {
                    return(HttpNotFound());
                }

                eventVm.Id = eventModel.Id;

                eventVm.EventName        = eventModel.EventName;
                eventVm.EventDescription = eventModel.EventDescription;
                eventVm.Venue            = eventModel.Venue;
                eventVm.ArtistId         = eventModel.ArtistId;
                eventVm.Venue            = eventModel.Venue;
                eventVm.City             = eventModel.City;
                eventVm.Country          = eventModel.Country;
                eventVm.StartDate        = eventModel.StartDate.ToString("dd/MM/yyyy hh:mm tt");
                eventVm.EndDate          = eventModel.EndDate.ToString("dd/MM/yyyy hh:mm tt");
                return(PartialView("_PartialAddEdit", eventVm));
            }
            catch (Exception exp)
            {
                _log.Error(exp);
                return(View("Error"));
            }
        }
Пример #7
0
        public async Task <ActionResult> Edit(int id)
        {
            try
            {
                EditViewBagParams();
                if (id <= 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ApplicationUser userModel = await _applicationUserQuery.GetAsync(id);

                ArtistViewModel userdataModel = ArtistViewModel.EntityToModels(userModel);
                if (userModel == null)
                {
                    return(HttpNotFound());
                }
                return(PartialView("_PartialAddEdit", userdataModel));
            }
            catch (Exception exp)
            {
                _log.Error(exp);
                return(View("Error"));
            }
        }