64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
|
namespace LOC.Website.Web.Controllers
|
|||
|
{
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Web.Mvc;
|
|||
|
using Common.Models;
|
|||
|
using Core.Model.Server;
|
|||
|
using Core.Tokens.Client;
|
|||
|
using Newtonsoft.Json;
|
|||
|
|
|||
|
public class PetsController : Controller
|
|||
|
{
|
|||
|
private readonly IPetAdministrator _petAdministrator;
|
|||
|
|
|||
|
public PetsController(IPetAdministrator petAdministrator)
|
|||
|
{
|
|||
|
_petAdministrator = petAdministrator;
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public ContentResult GetPets(List<Pet> pets)
|
|||
|
{
|
|||
|
var json = JsonConvert.SerializeObject(_petAdministrator.GetPets(pets));
|
|||
|
return Content(json, "application/json");
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public ContentResult GetPetExtras(List<PetExtra> petExtras)
|
|||
|
{
|
|||
|
var json = JsonConvert.SerializeObject(_petAdministrator.GetPetExtras(petExtras));
|
|||
|
return Content(json, "application/json");
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public void AddPet(PetChangeToken pet)
|
|||
|
{
|
|||
|
_petAdministrator.AddPet(pet);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public void UpdatePet(PetChangeToken pet)
|
|||
|
{
|
|||
|
_petAdministrator.UpdatePet(pet);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public void RemovePet(PetChangeToken pet)
|
|||
|
{
|
|||
|
_petAdministrator.RemovePet(pet);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public void AddPetNameTag(string name)
|
|||
|
{
|
|||
|
_petAdministrator.AddPetNameTag(name);
|
|||
|
}
|
|||
|
|
|||
|
[HttpPost]
|
|||
|
public void RemovePetNameTag(string name)
|
|||
|
{
|
|||
|
_petAdministrator.RemovePetNameTag(name);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|