Esempio n. 1
0
        internal homework getTareas(int id)
        {
            //IEnumerable<filesHomework> result=contexto.filesHomework.Where(a => a.idHome == id);
            homework tarea = contexto.homework.Where(a => a.id == id).First();

            return(tarea);
        }
Esempio n. 2
0
        public RedirectToRouteResult AgregarTarea(homework home, string filenames)
        {
            if (Session["id"] != null)
                home.idUs = (int)Session["id"];
            if (db.insertHomeworks(home,filenames))
            {
                return RedirectToAction("Lista");
            }
            else {
                return RedirectToAction("AgregarTarea");

            }
        }
Esempio n. 3
0
        internal bool deleteHomeWork(int idHome)
        {
            homework home = contexto.homework.Where(a => a.id == idHome).First();

            contexto.homework.Remove(home);
            try
            {
                contexto.SaveChanges();
                return(true);
            }
            catch {
                return(false);
            }
        }
Esempio n. 4
0
        internal void updateTarea(homework home, string filesnames)
        {
            homework tarea = getTareas(home.id);

            tarea.title        = home.title;
            tarea.date_emision = home.date_emision;
            tarea.date_end     = home.date_end;
            tarea.descriptions = home.descriptions;
            contexto.SaveChanges();
            if (home.urldownload != "none")
            {
                //deleteFilesHomework(home.id);
                addWorksFiles(home.urldownload, home.id, filesnames);
            }
        }
Esempio n. 5
0
        internal bool insertHomeworks(homework home, string filenames)
        {
            /*
             * Insertamos la talbla correspondiente a los archivos de cada tarea emitida
             * sobre la tabla fileHomework
             */
            string dataurl = home.urldownload;

            home.urldownload = "none";
            contexto.homework.Add(home);
            contexto.SaveChanges();

            addWorksFiles(dataurl, home.id, filenames);
            return(true);
        }
Esempio n. 6
0
 public RedirectToRouteResult actualizarTarea(homework home, string filenames)
 {
     db.updateTarea(home,filenames);
     return RedirectToAction("Lista");
 }
Esempio n. 7
0
 internal void updateTarea(homework home,string filesnames)
 {
     homework tarea = getTareas(home.id);
     tarea.title = home.title;
     tarea.date_emision = home.date_emision;
     tarea.date_end = home.date_end;
     tarea.descriptions = home.descriptions;
     contexto.SaveChanges();
     if (home.urldownload != "none")
     {
         //deleteFilesHomework(home.id);
         addWorksFiles(home.urldownload,home.id,filesnames);
     }
 }
Esempio n. 8
0
        internal bool insertHomeworks(homework home, string filenames)
        {
            /*
             Insertamos la talbla correspondiente a los archivos de cada tarea emitida
             * sobre la tabla fileHomework
             */
            string dataurl = home.urldownload;
                home.urldownload = "none";
                contexto.homework.Add(home);
                contexto.SaveChanges();

                addWorksFiles(dataurl,home.id,filenames);
                return true;
        }