Base solution for your next web application
Open Closed

Help - CRUD - Edit row in database table using Modal #2379


User avatar
0
epayday created

Hi, we want to use a copy of the _CreateXxxxxModal.cshtml as an _EditXxxxxModal.cshtml. We will need to populate the modal as it opens with the row data for the row that was selected Id. Allow change s and if the save button is pressed update the data in that row of the database table for that Id.

We are not sure where to start and are concerned of taking the wrong direction causing further delays. Do we start by going to the AppService file and adding an Async function? Not sure how we get the Modal to populate.

Do we use

FindAsync InsertAsync

UpdateAsync

?????????

    //[AbpAuthorize(AppPermissions.Pages_Tenant_PayRate_Edit)]
    //public async Task EditPayRate(EntityDto input)
    //{
    //    var payRate = input.PayRateID;
    //    var payRatedetails = _payRateRepository
    //                        .GetAll()
    //                        .WhereIf(!(payRate.Equals(0)),
    //                                   p => p.PayRateID.Equals(payRate)).ToList();

    //    if (payRatedetails.Count > 0)
    //    {
    //        var entity = await _payRateRepository
    //                                .EpdPayRate
    //                                .FindAsync(entity => entity.SomeId == matchingId);

    //        entity.PropertyA = "something";
    //        entity.PropertyB = 1;
    //        await _payRateRepository.SaveChangesAsync();
    //    }
    //    else
    //    {
    //        var payRateinfo = input.MapTo<PayRate>();
    //        await _payRateRepository.InsertAsync(payRate);
    //    }
    //}

Thanks, e-PayDay.


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

    Hi,

    The scenario you are trying to do is exactly like the ones we do in Roles and Users pages. You can select one of them (Roles or Users), then you can implement a similar functionality like that.

    Thanks.