Ejemplo n.º 1
0
        public ActionResult Uploadassignments(int tid, int cid, int secid, UploadAssignment at, HttpPostedFileBase file)
        {
            DB35Entities db = new DB35Entities();
            Assignment   a  = new Assignment();

            a.Name = file.FileName;

            a.TotalMarks = at.TotalMarks;
            string path = Path.Combine(Server.MapPath("~/TFiles"), Path.GetFileName(file.FileName));

            file.SaveAs(path);
            a.Path        = path;
            at.filename   = file.FileName;
            a.TeacherId   = tid;
            a.SectionId   = secid;
            a.CourseId    = cid;
            a.Title       = at.Title;
            a.Description = at.Desription;
            a.DueDate     = at.Duedate;
            db.Assignments.Add(a);
            db.SaveChanges();

            a.Title       = "";
            a.Description = "";
            a.DueDate     = DateTime.Now;
            a.TotalMarks  = 0;

            return(RedirectToAction("ViewAll", "Teacher", new { id = tid }));
        }
Ejemplo n.º 2
0
        public ActionResult Uploadedassign(int tid, int cid, int secid)
        {
            DB35Entities            db = new DB35Entities();
            List <UploadAssignment> a  = new List <UploadAssignment>();

            foreach (Assignment at in db.Assignments.Where(x => x.TeacherId == tid && x.CourseId == cid && x.SectionId == secid).ToList())
            {
                UploadAssignment f = new UploadAssignment();
                f.AssignmentId = at.AssignmentId;
                f.TeacherId    = tid;
                f.SectionId    = secid;
                f.Duedate      = at.DueDate;
                f.CourseId     = cid;
                f.Title        = at.Title;
                f.Desription   = at.Description;
                a.Add(f);
            }
            return(View(a));
        }