Added methods to convert tasks.

This commit is contained in:
Jonathan Williams 2015-05-12 18:59:22 -07:00
parent b1a46d0f0d
commit aee0952c17
7 changed files with 275 additions and 229 deletions

View File

@ -78,6 +78,7 @@
<Compile Include="Model\Server\PvpServer\Weapon.cs" /> <Compile Include="Model\Server\PvpServer\Weapon.cs" />
<Compile Include="Tokens\AccountBatchToken.cs" /> <Compile Include="Tokens\AccountBatchToken.cs" />
<Compile Include="Tokens\AccountNameToken.cs" /> <Compile Include="Tokens\AccountNameToken.cs" />
<Compile Include="Tokens\AccountTask.cs" />
<Compile Include="Tokens\Client\AccountTransactionToken.cs" /> <Compile Include="Tokens\Client\AccountTransactionToken.cs" />
<Compile Include="Tokens\Client\CoinTransactionToken.cs" /> <Compile Include="Tokens\Client\CoinTransactionToken.cs" />
<Compile Include="Tokens\Client\RankUpdateToken.cs" /> <Compile Include="Tokens\Client\RankUpdateToken.cs" />

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LOC.Core.Tokens
{
public class AccountTask
{
public string Task { get; set; }
public string UUID { get; set; }
}
}

View File

@ -72,6 +72,27 @@
return accounts; return accounts;
} }
public List<AccountTask> GetTasksByCount(int count)
{
var tasks = new List<AccountTask>();
using (var repository = _repositoryFactory.CreateRepository())
{
var gameTasks = repository.GetAll<GameTask>().OrderBy(x => x.GameTaskId).Take(count).Include(x => x.Account).ToList();
foreach (var task in gameTasks)
{
AccountTask accountTask = new AccountTask();
accountTask.Task = task.TaskName;
accountTask.UUID = task.Account.Uuid;
tasks.Add(accountTask);
}
}
return tasks;
}
private object getAccountLock(string name) private object getAccountLock(string name)
{ {
object lockObject = null; object lockObject = null;

View File

@ -41,5 +41,7 @@
bool CoinReward(GemRewardToken token); bool CoinReward(GemRewardToken token);
ClientToken GetAccountByUUID(string uuid); ClientToken GetAccountByUUID(string uuid);
List<AccountTask> GetTasksByCount(int count);
} }
} }

View File

@ -39,6 +39,15 @@
return Content(json, "application/json"); return Content(json, "application/json");
} }
[HttpPost]
public ActionResult GetTasksByCount(int count)
{
var tasks = _accountAdministrator.GetTasksByCount(count);
var json = JsonConvert.SerializeObject(tasks);
return Content(json, "application/json");
}
[HttpPost] [HttpPost]
public ActionResult GetAccountByUUID(string uuid) public ActionResult GetAccountByUUID(string uuid)
{ {

File diff suppressed because it is too large Load Diff

Binary file not shown.