Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 818 Bytes

README.md

File metadata and controls

32 lines (28 loc) · 818 Bytes

x-editable-net

This library supports x-editable updates with EntityFramework.

public class DefaultRequest
{
    public int pk { get; set; }
    public string name { get; set; }
    public string value { get; set; }
    public string entity { get; set; }
}

Api endpoint for handling the updates, int the the primary key type.

[HttpPatch]
public dynamic InlineEdit([FromBody]DefaultRequest request)
{
    try
    {
        var command = new UpdateEntityCommand<int>(request.pk, request.value, request.name, exportedTypes[request.entity]);
        handler.Handle(command);
        return Ok();
    }
    catch (Exception ex)
    {
        return BadRequest($"Failed due to  {JsonConvert.SerializeObject(ex, Formatting.Indented)}");
    }
}