public static PhraseModel Convert(this Phrase @this)
        {
            var phrase = new PhraseModel
            {
                Id          = @this.Id,
                Value       = @this.Value,
                AddDate     = @this.AddDate,
                Comment     = @this.Comment,
                Interesting = @this.Interesting,
                Source      = @this.Source.ConvertToString()
            };

            return(phrase);
        }
Exemple #2
0
        public int Add(PhraseModel newPhrase)
        {
            SqlDataAccess sql = new SqlDataAccess();

            var DeckInfo = sql.LoadData <DeckModel, dynamic>("dbo.spDeck_GetById", new { Id = newPhrase.DeckId }, "DictionaryData");

            if (DeckInfo.Count() == 0)
            {
                newPhrase.DeckId = null;
            }


            int result = sql.SaveData <PhraseModel, dynamic>("spPhrase_Insert", newPhrase, "DictionaryData");

            return(result);
        }
Exemple #3
0
        public async Task <int> PostPhrase(PhraseModel NewPhrase)
        {
            using (HttpResponseMessage response = await _apiHelper.ApiClient.PostAsJsonAsync("/api/Phrase/Add", NewPhrase))
            {
                if (response.IsSuccessStatusCode)
                {
                    var result = await response.Content.ReadAsAsync <int>();

                    return(result);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
        public int Add(PhraseModel newPhrase)
        {
            PhraseData data = new PhraseData();

            return(data.Add(newPhrase));
        }