示例#1
0
        public static bool Delete(ApplicationDbContext context, short id)
        {
            var entity = new JGN_MailTemplates {
                id = id
            };

            context.JGN_MailTemplates.Attach(entity);
            context.JGN_MailTemplates.Remove(entity);
            context.SaveChanges();
            return(true);
        }
示例#2
0
        public static async Task <JGN_MailTemplates> Add(ApplicationDbContext context, JGN_MailTemplates entity)
        {
            var _entity = new JGN_MailTemplates()
            {
                templatekey = entity.templatekey,
                description = entity.description,
                subjecttags = entity.subjecttags,
                tags        = entity.tags,
                subject     = entity.subject,
                contents    = entity.contents,
                type        = entity.type
            };

            context.Entry(_entity).State = EntityState.Added;
            await context.SaveChangesAsync();

            entity.id = _entity.id;

            return(entity);
        }