예제 #1
0
 /// <summary>
 /// Salva uma mensagem na base de dados
 /// </summary>
 /// <param name="newEntity"></param>
 /// <returns></returns>
 public VideoQuestionEntity CreateVideoQuestion(VideoQuestionEntity newEntity)
 {
     using (ModelContext context = new ModelContext())
     {
         newEntity.LastUpdate = DateTime.UtcNow;
         context.VideoQuestions.Attach(newEntity);
         context.Entry(newEntity).State = System.Data.Entity.EntityState.Added;
         context.SaveChanges();
     }
     return(newEntity);
 }
예제 #2
0
        /// <summary>
        /// Atualiza uma mensagem
        /// </summary>
        /// <param name="updatedEntity"></param>
        /// <returns></returns>
        public VideoQuestionEntity UpdateVideoQuestion(VideoQuestionEntity updatedEntity)
        {
            using (ModelContext context = new ModelContext())
            {
                updatedEntity.LastUpdate = DateTime.UtcNow;
                context.VideoQuestions.Attach(updatedEntity);
                context.Entry(updatedEntity).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();
            }

            return(updatedEntity);
        }