try rewirte of all backoffice controllers to ApiControllers
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
{
|
||||
@@ -15,20 +16,20 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> GetById([FromQuery] string id) => Edit(await Api.GetById(id));
|
||||
public async Task<EditModel<IPreview>> GetById([FromQuery] string id) => Edit(await Api.GetById(id));
|
||||
|
||||
|
||||
public async Task<IActionResult> Add([FromBody] IZeroEntity model)
|
||||
public async Task<EntityResult<string>> Add([FromBody] IZeroEntity model)
|
||||
{
|
||||
EntityResult<IPreview> preview = await Api.Add(model);
|
||||
return Json(EntityResult<string>.From(preview, preview.Model?.Id));
|
||||
return EntityResult<string>.From(preview, preview.Model?.Id);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IActionResult> Update([FromBody] string id, [FromBody] IZeroEntity model)
|
||||
public async Task<EntityResult<string>> Update([FromQuery] string id, [FromBody] IZeroEntity model)
|
||||
{
|
||||
EntityResult<IPreview> preview = await Api.Update(id, model);
|
||||
return Json(EntityResult<string>.From(preview, id));
|
||||
return EntityResult<string>.From(preview, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user