2019-03-30 23:04:15 -04:00
|
|
|
|
using System;
|
2019-04-11 21:43:05 -04:00
|
|
|
|
using System.Collections;
|
2019-03-30 23:04:15 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2019-04-11 21:43:05 -04:00
|
|
|
|
using System.Runtime.Serialization;
|
2019-03-30 23:04:15 -04:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2019-04-11 21:43:05 -04:00
|
|
|
|
using SharedLibraryCore.Configuration;
|
|
|
|
|
using WebfrontCore.ViewModels;
|
2019-03-30 23:04:15 -04:00
|
|
|
|
|
|
|
|
|
namespace WebfrontCore.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class ConfigurationController : BaseController
|
|
|
|
|
{
|
|
|
|
|
public IActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View("Index", Manager.GetApplicationSettings().Configuration());
|
|
|
|
|
}
|
2019-04-11 21:43:05 -04:00
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult Edit(ApplicationConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
return View("Index", Manager.GetApplicationSettings().Configuration());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IActionResult GetNewListItem(string propertyName, int itemCount)
|
|
|
|
|
{
|
|
|
|
|
var config = Manager.GetApplicationSettings().Configuration();
|
|
|
|
|
var propertyInfo = config.GetType().GetProperties().First(_prop => _prop.Name == propertyName);
|
|
|
|
|
|
|
|
|
|
var configInfo = new ConfigurationInfo()
|
|
|
|
|
{
|
|
|
|
|
Configuration = config,
|
|
|
|
|
PropertyValue = (IList)propertyInfo.GetValue(config),
|
|
|
|
|
PropertyInfo = propertyInfo,
|
|
|
|
|
NewItemCount = itemCount
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return PartialView("_ListItem", configInfo);
|
|
|
|
|
}
|
2019-03-30 23:04:15 -04:00
|
|
|
|
}
|
|
|
|
|
}
|