public string Get() { // get all singarea StateOfRequest mState = new StateOfRequest("LangNo"); List <Language> languages = _languagesManager.GetAllLanguages(mState); // Convert List<Language> to JSON array JObject jObjectForAll = new JObject(); jObjectForAll.Add("pageNo", mState.CurrentPageNo); jObjectForAll.Add("pageSize", mState.PageSize); jObjectForAll.Add("totalRecords", mState.TotalRecords); jObjectForAll.Add("totalPages", mState.TotalPages); JObject jObject; JArray jArray = new JArray(); foreach (var language in languages) { jObject = JsonUtil.ConvertlanguageToJsongObject(language); jArray.Add(jObject); } jObjectForAll.Add("languages", jArray); return(jObjectForAll.ToString()); }
public async Task <string> Get(int id) { // get one language Language language = await _languagesManager.FindOneLanguageById(id); JObject jObject = JsonUtil.ConvertlanguageToJsongObject(language); JObject returnJSON = new JObject(); returnJSON.Add("language", jObject); return(returnJSON.ToString()); }