Пример #1
0
        /**
         * Método para crear nuevo registro
         */
        public static void insert(String name, String description, List <templates_tasks> tasks, long userId)
        {
            using (var conn = new db_entities()) {
                try {
                    conn.SP_TEMPLATE_INSERT(name, description, DateTime.Now, 1, userId);

                    var entity = conn.templates.Where(x => x.name == name).FirstOrDefault();

                    foreach (templates_tasks tt in tasks)
                    {
                        conn.SP_TEMPLATE_TASK_INSERT(tt.name, tt.description, entity.id, tt.task_status_code, DateTime.Now, tt.end_date, userId);
                    }
                } catch (Exception e) {
                    throw e;
                }
            }
        }