Base solution for your next web application

Activities of "ninomartini"

Answer

Yes, the database was created. After seeing the warnings I thought there was an issue and didn't bother to refresh the database list.

Thank you for the prompt reply.

Answer

Yes, I had it working before and I just resolved the issue and wanted to share how it was solved.

To find the problem I turned off CustomErrors from the Web.config in the Web project to get a more detailed description of issue. From the detailed error message I learned the issue was related to my code having duplicate schemaIds.

Thank you for your assistance.

Answer

Thank you for the link, most helpful.

Answer

Thank you for the explanation.

Answer

I am sorry for the disconnect and I will try better to explain by asking the question differently.

Instead of displaying the list of timezones as:

 (UTC-07:00) Arizona
 (UTC-07:00) Chihuahua, La Paz, Mazatlán
 (UTC-07:00) Mountain Time (US & Canada)

Can we display them using the Moment abbreviated time zone names:

 America/Chihuahua
 America/Denver
 America/La_Paz
 America/Phoenix
Answer

Thank you for your response. I am surprised Moment Timezone was not used for this feature. Was there a reason not to use it? How difficult would it be to switch to Moment Timezone or make Moment Timezone an option?

Thank you for the quick response.

Yes, the web project is working without any issues.

As for DbGeography, this is an Entity Framework spatial type. To use the DbGeography type, you must add a reference to the System.Data.Entity assembly and also add the System.Data.Spatial using statement.

Again, thank you in advance.

Thank you for the quick response. I discovered my issue and wanted to share it here to make sure I am performing the update correctly by your standards.

I believe my issue was in my service method.

Orginal Update Method which was updated the CreatorUserId to NULL:

var group = input.MapTo<Group>();
await _groupRepository.UpdateAsync(group);

Corrected Update Method which now saves correctly:

var group = await _groupRepository.FirstOrDefaultAsync(g => g.Id == input.Id);
 input.MapTo(group);
 await _groupRepository.UpdateAsync(group);

Any suggestions?

Hello, Thank you for the quick reply.

Yes, both methods are in the same class which implements from an interface. However, making CreateGroup virtual had no impact. Maybe you can see something I did wrong? FYI, I am using 1.3.0 from a fresh download.

Again, I appreciate any assistance.

IGroupAppService.cs

public interface IGroupAppService : IApplicationService
    {
        Task<PagedResultOutput<GroupListDto>> GetGroups(GetGroupsInput input);
        Task CreateGroup(CreateGroupInput input);
        Task<GroupEditDto> GetGroupForEdit(EntityRequestInput input);        
        Task UpdateGroup(GroupEditDto input);
        Task DeleteGroup(EntityRequestInput input);
    }

Here is the complete GroupAppService.cs

[AbpAuthorize(AppPermissions.Pages_Tenant_Account_Groups)]
    public class GroupAppService : TracZuAppServiceBase, IGroupAppService
    {
        private readonly IRepository<Group, long> _groupRepository;

        public GroupAppService(IRepository<Group, long> groupRepository)
        {
            _groupRepository = groupRepository;
        }

        public async Task<PagedResultOutput<GroupListDto>> GetGroups(GetGroupsInput input)
        {
            var query = _groupRepository
                .GetAll()
                .WhereIf(
                    !input.Filter.IsNullOrEmpty(),
                    g => g.Name.Contains(input.Filter) ||
                         g.Description.Contains(input.Filter)
                );

            var resultCount = await query.CountAsync();
            var results = await query
                .AsNoTracking()
                .OrderBy(input.Sorting)
                .PageBy(input)
                .ToListAsync();

            return new PagedResultOutput<GroupListDto>(resultCount, results.MapTo<List<GroupListDto>>());
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Account_Groups_Create)]
        public async Task CreateGroup(CreateGroupInput input)
        {
            var group = input.MapTo<Group>();
            await _groupRepository.InsertAsync(group);
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Account_Groups_Edit)]
        public async Task<GroupEditDto> GetGroupForEdit(EntityRequestInput input)
        {
            var group = await _groupRepository.FirstOrDefaultAsync(g => g.Id == input.Id);
            return group.MapTo<GroupEditDto>();
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Account_Groups_Edit)]
        public async Task UpdateGroup(GroupEditDto input)
        {
            var group = input.MapTo<Group>();
            await _groupRepository.UpdateAsync(group);
        }

        [AbpAuthorize(AppPermissions.Pages_Tenant_Account_Groups_Delete)]
        public async Task DeleteGroup(EntityRequestInput input)
        {
            await _groupRepository.DeleteAsync(input.Id);
        }
    }

I am calling the CreateGroup from the Angular application via the following controller:

(function () {
    appModule.controller('tenant.views.groups.createModal', [
        '$scope', '$modalInstance', 'abp.services.app.group',
        function ($scope, $modalInstance, groupService) {
            var vm = this;

            vm.saving = false;
            vm.group = {};

            vm.save = function () {
                vm.saving = true;
                groupService.createGroup(vm.group)
                    .success(function () {
                        abp.notify.info(app.localize('SavedSuccessfully'));
                        $modalInstance.close();
                    }).finally(function () {
                        vm.saving = false;
                    });
            }

            vm.cancel = function () {
                $modalInstance.dismiss();
            }
        }
    ]);
})();
Showing 1 to 10 of 10 entries