Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error on profile picture change #2416


User avatar
0
avanekar02 created

hello to be more precise this is the error i get when i try to change picture

{"message":"An error has occurred.","exceptionMessage":"There is an action CreateOrUpdateCourseLevel defined for api controller app/courseLevel but with a different HTTP Verb. Request verb is GET. It should be Post","exceptionType":"Abp.AbpException","stackTrace":" at Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.GetActionDescriptorByActionName(HttpControllerContext controllerContext, DynamicApiControllerInfo controllerInfo, String actionName)\r\n at Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at Castle.Proxies.DynamicApiController1Proxy_4.ExecuteAsync_callback(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at Castle.Proxies.Invocations.ApiController_ExecuteAsync_4.InvokeMethodOnTarget()\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Abp.WebApi.Controllers.Dynamic.Interceptors.AbpDynamicApiControllerInterceptor1.Intercept(IInvocation invocation)\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.Proxies.DynamicApiController`1Proxy_4.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Anwar,

    I think this is also not related to profile picture problem. Can you share your CreateOrUpdateCourseLevel method ?

  • User Avatar
    0
    avanekar02 created

    using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; using Samit.CmsProTest.School.Courses.Dto; using Abp.Domain.Repositories; using Abp.AutoMapper; using Abp.Linq.Extensions; using Abp.Extensions; using Samit.CmsProTest.Authorization; using Abp.Authorization; using System.Data.Entity; using System; using System.Collections.Generic; using System.Linq; using Abp.UI; using System.Diagnostics;

    namespace Samit.CmsProTest.School.Courses { //[AbpAuthorize(AppPermissions.Pages_Tenant_Courselevels)] public class CourseLevelAppService : CmsProTestAppServiceBase, ICourseLevelAppService { private readonly IRepository<CourseLevel> _courselevelRepository;

        public CourseLevelAppService(IRepository&lt;CourseLevel&gt; courselevelRepository)
        //public CourseAppService(IRepository&lt;Course&gt; courseRepository, IRepository&lt;CourseDetail&gt; coursedetailRepository, IRepository&lt;CourseEdu&gt; courseeduRepository, IRepository&lt;Educator&gt; educatorRepository)
        {
            _courselevelRepository = courselevelRepository;
       
        }
    
    
    
        public ListResultDto&lt;CourseLevelListDto&gt; GetCourseLevel(GetCoursesInput input)
        {
            var courseslevel = _courselevelRepository
                .GetAll()
                 .Where(p => p.Type == input.type)
                 .WhereIf(
                    !input.Filter.IsNullOrEmpty(),
                    p => p.Name.Contains(input.Filter)
                  )
                .OrderBy(p => p.Id)
                .ToList();
    
            return new ListResultDto&lt;CourseLevelListDto&gt;(courseslevel.MapTo&lt;List&lt;CourseLevelListDto&gt;>());
        }
    
    
    
        public async Task&lt;CourseLevelListDto&gt; GetCourseLevelForEdit(GetCoursesInput input)
        {
            var @courselevel = await _courselevelRepository
                 .GetAll()
                 .Where(e => e.Id == input.Id)
                 .FirstOrDefaultAsync();
    
            if (@courselevel == null)
            {
                throw new UserFriendlyException("courselevel Could not be found, maybe it's deleted.");
            }
    
            return @courselevel.MapTo&lt;CourseLevelListDto&gt;();
        }
    
    
    
        public async Task CreateOrUpdateCourseLevel(CreateCourseLevelinput input)
        {
            if (input.Id.HasValue)
            {
                await UpdateCourseLevelAsync(input);
            }
            else
            {
                await CreateCourseLevelAsync(input);
            }
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Tenant_Courselevels_Edit)]
        protected virtual async Task UpdateCourseLevelAsync(CreateCourseLevelinput input)
        {
            Debug.Assert(input.Id != null, "input.CourseLevel.Id should be set.");
    
            var courselevel = _courselevelRepository.FirstOrDefault(Convert.ToInt32(input.Id));
            courselevel.Name = input.Name;
            courselevel.CourseDesc = input.CourseDesc;
            courselevel.ARCourseDesc = input.ARCourseDesc;
            courselevel.ARName = input.ARName;
            courselevel.Active = input.Active;
            courselevel.Type = input.Type;
            courselevel.Image = input.Image;
    
            await _courselevelRepository.UpdateAsync(courselevel);
    
    
        }
    
        [AbpAuthorize(AppPermissions.Pages_Tenant_Courselevels_Create)]
        public async Task CreateCourseLevelAsync(CreateCourseLevelinput input)
        {
            var courselevel = input.MapTo&lt;CourseLevel&gt;();
            await _courselevelRepository.InsertAsync(courselevel);
    
        }
    
    
        [AbpAuthorize(AppPermissions.Pages_Tenant_Courselevels_Delete)]
        public async Task DeleteCourseLevel(GetCoursesInput input)
        {
            await _courselevelRepository.DeleteAsync(Convert.ToInt32(input.Id));
        }
    
    
    
    
    
    
    }
    

    }

  • User Avatar
    0
    avanekar02 created

    Sent you the login credentials for the site,

    To Mimic the error, you need to do the needful.

    after logging in on the left menus select category, click create new,

    enter 'HomeDecor' for all fields check active and select recording option load any image from your local system press 'SAVE'

    once logged in you can also try to change profile picture and see the other error.

    Regards Anwar