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());
        }
        // GET: Language/Edit/5
        public async Task <IActionResult> Edit(string language_state)
        {
            if (!LoginUtil.CheckIfLoggedIn(HttpContext))
            {
                return(View(nameof(Index)));
            }

            StateOfRequest mState;

            if (string.IsNullOrEmpty(language_state))
            {
                mState = new StateOfRequest("LangNo");
            }
            else
            {
                mState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(language_state);
            }

            int      id       = mState.OrgId;
            Language language = await _languagesManager.FindOneLanguageById(id);

            if (language == null)
            {
                // go to previous view (List view)
                return(Redirect(HttpContext.Request.Headers["Referer"]));
            }
            else
            {
                mState.OrgId = language.Id;
                mState.OrgNo = language.LangNo;
                string temp_state = JsonUtil.SetJsonStringFromObject(mState);

                ViewBag.LanguageState = temp_state;
                return(View(language));
            }
        }
        public async Task <IActionResult> Find(string song_no, string vod_no, string song_na, int languageId, string sing_na1, string sing_na2, string search_type, string submitbutton, string song_state)
        {
            if (!LoginUtil.CheckIfLoggedIn(HttpContext))
            {
                return(View(nameof(Index)));
            }

            StateOfRequest mState;

            if (string.IsNullOrEmpty(song_state))
            {
                mState = new StateOfRequest("SongNo");
            }
            else
            {
                mState = JsonUtil.GetObjectFromJsonString <StateOfRequest>(song_state);
            }
            mState.StartTime = DateTime.Now;
            string temp_state = JsonUtil.SetJsonStringFromObject(mState);

            if (string.IsNullOrEmpty(song_no))
            {
                song_no = string.Empty;
            }
            song_no = song_no.Trim();

            if (string.IsNullOrEmpty(vod_no))
            {
                vod_no = string.Empty;
            }
            vod_no = vod_no.Trim();

            if (string.IsNullOrEmpty(song_na))
            {
                song_na = string.Empty;
            }
            song_na = song_na.Trim();

            string lang_no = "";

            if (languageId >= 0)
            {
                Language language = await _languagesManager.FindOneLanguageById(languageId);

                if (language != null)
                {
                    lang_no = language.LangNo;
                }
            }

            if (string.IsNullOrEmpty(sing_na1))
            {
                sing_na1 = string.Empty;
            }
            sing_na1 = sing_na1.Trim();

            if (string.IsNullOrEmpty(sing_na2))
            {
                sing_na2 = string.Empty;
            }
            sing_na2 = sing_na2.Trim();

            string sButton = submitbutton.ToUpper();

            if (sButton == "CANCEL")
            {
                temp_state = JsonUtil.SetJsonStringFromObject(mState);
                return(RedirectToAction(nameof(SongsList), new { song_state = temp_state }));
            }

            if (string.IsNullOrEmpty(search_type))
            {
                // search_type not defined
                return(View());
            }

            string searchType = search_type.Trim();

            mState.OrderBy = searchType;

            Song song = new Song();                // new object

            song.SongNo = song_no;                 // for order by "SongNo"

            song.SongNa = song_na;                 // for order by "SongNa"

            song.VodNo = vod_no;                   // for order by "VodNo"

            song.Language        = new Language(); // for order by "LangNo" + "SongNa"
            song.Language.LangNo = lang_no;
            song.SongNa          = song_na;

            song.Singer1        = new Singer(); // for order by "Singer1.SingNa"
            song.Singer1.SingNa = sing_na1;

            song.Singer2        = new Singer(); // for order by "Singer2.SingNa"
            song.Singer2.SingNa = sing_na2;

            List <Song> songsTemp = _songsManager.FindOnePageOfSongsForOneSong(mState, song, -1);

            temp_state        = JsonUtil.SetJsonStringFromObject(mState);
            ViewBag.SongState = temp_state;

            return(View(nameof(SongsList), songsTemp));
        }