Base solution for your next web application

Activities of "marble68"

TakerController:

using System;
using System.Threading.Tasks;
using Abp.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc;
using okto.work.Web.Areas.App.Models.Takers;
using okto.work.Web.Controllers;
using okto.work.Authorization;
using okto.work.Chat;
using okto.work.Chat.Dtos;
using Abp.Application.Services.Dto;
using Abp.Extensions;
using okto.work.Storage;
using Abp.BackgroundJobs;

namespace okto.work.Web.Areas.App.Controllers
{
    [Area("App")]
    [AbpMvcAuthorize(AppPermissions.Pages_Takers)]
    public class TakersController : TakersControllersBase //workControllerBase
    {
        private readonly ITakersAppService _takersAppService;

        public TakersController(IBinaryObjectManager binaryObjectManager, IBackgroundJobManager backgroundJobManager, ITakersAppService takersAppService)
            : base(binaryObjectManager, backgroundJobManager)
        {
            _takersAppService = takersAppService;
        }

        public ActionResult Index()
        {
            var model = new TakersViewModel
            {
                FilterText = ""
            };

            return View(model);
        }


        [AbpMvcAuthorize(AppPermissions.Pages_Takers_Create, AppPermissions.Pages_Takers_Edit)]
        public async Task<PartialViewResult> CreateOrEditModal(Guid? id)
        {
            GetTakerForEditOutput getTakerForEditOutput;

            if (id.HasValue)
            {
                getTakerForEditOutput = await _takersAppService.GetTakerForEdit(new EntityDto<Guid> { Id = (Guid)id });
            }
            else
            {
                getTakerForEditOutput = new GetTakerForEditOutput
                {
                    Taker = new CreateOrEditTakerDto()
                };
                getTakerForEditOutput.Taker.dateCleared = DateTime.Now;
                getTakerForEditOutput.Taker.dateClearExpires = DateTime.Now;
                getTakerForEditOutput.Taker.dateLastSurvey = DateTime.Now;
            }

            var viewModel = new CreateOrEditTakerModalViewModel()
            {
                Taker = getTakerForEditOutput.Taker,
            };

            return PartialView("_CreateOrEditModal", viewModel);
        }


        public async Task<PartialViewResult> ViewTakerModal(Guid id)
        {
            var getTakerForViewDto = await _takersAppService.GetTakerForView(id);

            var model = new TakerViewModel()
            {
                Taker = getTakerForViewDto.Taker
            };

            return PartialView("_ViewTakerModal", model);
        }


    }
}

Do you want me to email or post here?

Im still getting a 404.

ive tried changing authorization but still 404s.

is there a route or something i have to do to get the method to process?

I updated the TakerController in both MVC and Host.

Was it ever resolved what the problem was here?

For anyone wondering - this in the right place - but I was doing it wrong.

The key is to add rules at the end of the init function, after .validate() is called.

I'm still not sure this is the best place, as I fear my rules will be dumped on an entity regen.

This worked:

         _$takerInformationForm.validate();
            $("#Taker_wasManuallyClearedReason").rules("add", {
                required: function () { return ($("#Taker_isclear").is(':checked') != _TakerClearStatusOnLoad) },
                minlength: 5,
                messages: {
                    required: "Please provide a reason for changing the clear status",
                    minlength: jQuery.validator.format("At least {0} characters are necessary")
                }
            });

Ok - I've got this working - part way.

Now, the Taker goes to the public website, enters some info - and I need to update that Taker entity from the public website.

Does disabling filters resolve calling CreateOrEdit?

Here's what I'm doing:

            using (var uow = UnitOfWorkManager.Begin())
            {
                using (CurrentUnitOfWork.SetTenantId(null))
                {
                    using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
                    {
                        _takersAppService.CreateOrEdit(input).Wait();

                        uow.Complete();
                    }
                }
            }

The error I'm getting is:

AbpAuthorizationException: Current user did not login to the application!

THanks for any advice.

I found the problem, but can't explain what caused it. Documenting here in case someone else faces this same issue.

For some reason, the iisexpress config picked up my controller's path as a Virtual Directory.

I edited the applicantionhost.config file in <root>.vs&lt;project>\config.

Removing the virtual directories resolved the issue.

How cow - I didn't even know about abp commercial.

Thank you - Sorry - bit new.

I have a page for users to create custom portlets.

Then, on another page, the users can drag drop their portlets out of their "toolbox", creating a portlet page. (An entity that contains a list of portlets and their arrangement).

Finally, the custom portlet page is rendered to the public facing side. Sort of like how the dashboard behaves, but this is for the user to define what's rendered and how.

Thanks for your help !!

Showing 151 to 160 of 170 entries