-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zmn
committed
Apr 9, 2017
1 parent
b7d4369
commit 31b28ce
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Http; | ||
using NLog; | ||
using Wlog.BLL.Entities; | ||
using Wlog.Library.BLL.Reporitories; | ||
|
||
namespace Wlog.Web.Code.API | ||
{ | ||
[AllowAnonymous] | ||
public class DictionaryController : ApiController | ||
{ | ||
private readonly Logger _logger = LogManager.GetCurrentClassLogger(); | ||
|
||
|
||
|
||
public KeyPairEntity Get(Guid publicKey, string dictionaryName, string key) | ||
{ | ||
try | ||
{ | ||
var application = RepositoryContext.Current.Applications.GetByApplicationKey(publicKey.ToString()); | ||
if (application == null) throw new Exception("Unable to find appliction"); | ||
var dictionary = RepositoryContext.Current.KeyPairRepository.GetDictionaries(application.Id, dictionaryName, 0, 1).FirstOrDefault(); | ||
if (dictionary == null) throw new Exception("Unable to find dictionary"); | ||
return new KeyPairEntity() | ||
{ | ||
ItemValue = RepositoryContext.Current.KeyPairRepository.GetByKey(dictionary.Id, key) | ||
}; | ||
|
||
|
||
} | ||
catch (Exception err) | ||
{ | ||
_logger.Error(err); | ||
throw err; | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters