loading + error states for forms

This commit is contained in:
2020-04-19 18:22:44 +02:00
parent 613b1a2660
commit e417732a98
3 changed files with 64 additions and 7 deletions
@@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using zero.Core;
using zero.Core.Identity;
using zero.Web.Mapper;
namespace zero.Web.Controllers
{
@@ -9,10 +11,30 @@ namespace zero.Web.Controllers
{
protected IZeroConfiguration Configuration { get; set; }
protected IMapper Mapper { get; set; }
public BackofficeController(IZeroConfiguration config, IMapper mapper)
{
Configuration = config;
Mapper = mapper;
}
public BackofficeController(IZeroConfiguration config)
{
Configuration = config;
}
protected IActionResult Json<T, TTarget>(T model) where TTarget : class, new()
{
if (model == null)
{
return new StatusCodeResult(404);
}
return Json(Mapper.Map<T, TTarget>(model));
}
}
}