protected override PhraseBeliefDto InsertImpl(PhraseBeliefDto dto)
 {
     using (var ctx = LearnLanguagesContextManager.Instance.GetManager())
     {
         PhraseBeliefData newPhraseBeliefData = EfHelper.AddToContext(dto, ctx.ObjectContext);
         ctx.ObjectContext.SaveChanges();
         dto.Id = newPhraseBeliefData.Id;
         return(dto);
     }
 }
Example #2
0
        public static PhraseBeliefDto ToDto(PhraseBeliefData data)
        {
            var dto = new PhraseBeliefDto()
            {
                Id             = data.Id,
                BelieverId     = data.BelieverId,
                PhraseId       = data.PhraseDataId,
                ReviewMethodId = data.ReviewMethodId,
                Strength       = data.Strength,
                Text           = data.Text,
                TimeStamp      = data.TimeStamp,
                UserId         = data.UserDataId,
                Username       = data.UserData.Username,
            };

            return(dto);
        }
Example #3
0
        public static void LoadDataFromDto(ref PhraseBeliefData data,
                                           PhraseBeliefDto dto,
                                           LearnLanguagesContext context)
        {
            //USER INFO
            data.UserDataId = dto.UserId;
            data.UserData   = EfHelper.GetUserData(dto.UserId, context);

            //PHRASE
            data.PhraseDataId = dto.PhraseId;
            data.PhraseData   = EfHelper.GetPhraseData(dto.PhraseId, context);

            //SCALAR
            data.ReviewMethodId = dto.ReviewMethodId;
            data.Strength       = dto.Strength;
            data.Text           = dto.Text;
            data.TimeStamp      = dto.TimeStamp;
        }