sodoff/src/Controllers/Common/ItemStoreController.cs
Spirtix 0460746824 implement store, purchases; fix inventory
This only implements V2 purchases
V1 purchases are used outside of the store
2023-07-03 19:38:52 +02:00

45 lines
1.3 KiB
C#

using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using sodoff.Model;
using sodoff.Schema;
using sodoff.Services;
using sodoff.Util;
namespace sodoff.Controllers.Common;
public class ItemStoreController : Controller {
private readonly DBContext ctx;
private StoreService storeService;
public ItemStoreController(DBContext ctx, StoreService storeService) {
this.ctx = ctx;
this.storeService = storeService;
}
[HttpPost]
[Produces("application/xml")]
[Route("ItemStoreWebService.asmx/GetStore")]
public IActionResult GetStore([FromForm] string getStoreRequest) {
GetStoreRequest request = XmlUtil.DeserializeXml<GetStoreRequest>(getStoreRequest);
ItemsInStoreData[] stores = new ItemsInStoreData[request.StoreIDs.Length];
for (int i = 0; i < request.StoreIDs.Length; i++) {
stores[i] = storeService.GetStore(request.StoreIDs[i]);
}
GetStoreResponse response = new GetStoreResponse {
Stores = stores
};
return Ok(response);
}
[HttpPost]
//[Produces("application/xml")]
[Route("ItemStoreWebService.asmx/GetRankAttributeData")]
public IActionResult GetRankAttributeData() {
// TODO
return Ok(XmlUtil.ReadResourceXmlString("rankattrib"));
}
}