Reputation: 3376
I want to use the DELETE HTTP verb with MVC razor, but can't find a way to do so. I tried having a form use
@foreach (var result in Model.Results)
{
<li>
<form action="@result.DeleteUrl" method="POST">
<input name="X-HTTP-Method-Override" type="hidden" value="DELETE" />
<input type="submit" value="Delete"/>
</form>)
</li>
}
[Route("/results/{Id}", "POST,DELETE")]
public class Result
{
public string Id { get; set; }
public string DeleteUrl
{
get
{
return "/results/{0}".Fmt(Id);
}
}
public Result() { }
public Result(string id)
{
Id = id;
}
}
public class ResultsService : Service
{
public object Delete(Result request)
{
// TODO: Never called!
return null;
}
}
This still does not call my Delete callback on my service. I've seen that the http://razor-console.servicestack.net/rockstars example uses GET with a delete url to delete its items! POST works fine, but I want to use DELETE.
Thanks,
Martin
Upvotes: 1
Views: 483
Reputation: 4816
I asked about this in the ServiceStack Google Group. https://groups.google.com/forum/?fromgroups=#!topic/servicestack/HY-dCjgq2Pw
It doesn't appear ServiceStack currently has support for what you are trying do to in your Form.
Upvotes: 2