Example #1
0
        /// <summary>
        /// Remove um objeto da base dados
        /// </summary>
        /// <param name="items">Item Operantante pode se passar um unique ou lista de objetos a ser salvo</param>
        public virtual void Remove(params T[] items)
        {
            var context = new WpCheckInContext();

            foreach (T item in items)
            {
                context.Entry(item).State = EntityState.Deleted;
            }
            context.SaveChanges();
        }
Example #2
0
        /// <summary>
        /// Adiciona um item na base de dados
        /// </summary>
        /// <param name="items">Baseado na classe operante</param>
        public virtual int Add(params T[] items)
        {
            var context = new WpCheckInContext();

            var item = items.FirstOrDefault();

            context.Entry(item).State = EntityState.Added;
            context.SaveChanges();

            return((item as dynamic).ID);
        }