Ejemplo n.º 1
0
        public void DeleteTask(int id)
        {
            AU_TASK task = _context.AU_TASK.Find(id);

            _context.AU_TASK.Remove(task);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public int AddTask(AU_TASK au_task)
        {
            int result = -1;

            if (au_task != null)
            {
                _context.AU_TASK.Add(au_task);
                _context.SaveChanges();
                result = au_task.TASK_ID;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public int UpdateTask(AU_TASK au_task)
        {
            int result = -1;

            if (au_task != null)
            {
//                 This line of code is telling the data context about an object whose values already live in the database
//(this is not a brand-new album, but an existing album), so the framework should apply the values
//inside to an existing album and not try to create a new album record. The next line of code invokes
//SaveChanges on the data context, and at this point the context formulates a SQL UPDATE command
//to persist the new values.
                _context.Entry(au_task).State = EntityState.Modified;
                _context.SaveChanges();
                result = au_task.TASK_ID;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public AU_TASK GetTaskById(int id)
        {
            AU_TASK task = _context.AU_TASK.Find(id);

            return(task);
        }