Undeletehandler/Soft delete is missing in Serene 6.0.0 #6393
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
In all the versions, soft deletes, you have to implement it yourself. If you have issues, search the issues first, then discussions. If all else fails, read the docs. Although the docs is pretty good if you go through tutorial... in any case here is how to implement undelete: |
Beta Was this translation helpful? Give feedback.
-
If it helps anyone this is my code to add to the endpoint.cs for Serene 6.0.0 It's not very elegant but it works [HttpPost, AuthorizeDelete(typeof(MyRow))] |
Beta Was this translation helpful? Give feedback.
-
Create UndeleteHandler.cs
Add in Endpoint.cs
you should add this in MyRow.cs |
Beta Was this translation helpful? Give feedback.
-
Hi Mehmet,
thank you so much for your answer.
Best regards
Roberto
Il giorno ven 26 mag 2023 alle ore 09:47 Mehmet Akif Colak <
***@***.***> ha scritto:
… Create UndeleteHandler.cs
using MyRequest = Serenity.Services.UndeleteRequest;
using MyResponse = Serenity.Services.UndeleteResponse;
using MyRow = MyRow;
public interface IUndeleteHandler : IUndeleteHandler<MyRow, MyRequest,
MyResponse> { }
public class UndeleteHandler : UndeleteRequestHandler<MyRow, MyRequest, MyResponse>, IUndeleteHandler
{
public UndeleteHandler(IRequestContext context)
: base(context)
{
}
}
Add in Endpoint.cs
[HttpPost, AuthorizeDelete(typeof(MyRow))]
public UndeleteResponse Undelete(IUnitOfWork uow, UndeleteRequest request,
[FromServices] IUndeleteHandler handler)
{
return handler.Undelete(uow, request);
}
you should add this in MyRow.cs
public sealed class MyRow : Row<MyRow.RowFields>, IIdRow, INameRow,
IIsActiveRow
and add in MyGrid.ts
protected getIsActiveProperty() { return MyRow.isActiveProperty; }
I hope it helps someone.
—
Reply to this email directly, view it on GitHub
<#6393 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHB2QS66CSE3YHMY26NA56LXIBNXHANCNFSM5VUW4FXA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
In all the versions, soft deletes, you have to implement it yourself. If you have issues, search the issues first, then discussions. If all else fails, read the docs. Although the docs is pretty good if you go through tutorial... in any case here is how to implement undelete:
#2741