public ActionResult Edit([Bind(Include = "ModuleId,Description,MaxCount,Year,semester,LecturerIncharge,MaxLecPanel")] Module module)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.Entry(module).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["Msg1"] = "Successfully Updted!";
                    return(RedirectToAction("ViewAll"));
                }
                catch (Exception ex)
                {
                    ComboValues();
                    TempData["Msg1"] = "Error in Updating!";
                    return(View(module));

                    throw ex;
                }
            }
            else
            {
                ComboValues();
                return(View(module));
            }
        }
Esempio n. 2
0
        public ActionResult ViewLecIC([Bind(Include = "LecturerIncharge")] Module module)
        {
            if (ModelState.IsValid)
            {
                db.Entry(module).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("ViewAll"));
            }

            return(View(module));
        }
Esempio n. 3
0
        public ActionResult Edit([Bind(Include = "id,Supervisors,Lecturers")] AllocatedLecturers allocatedLecturers)
        {
            int table_rows = db.AllocatedLecturers.Count(ac => ac.Supervisors.Equals(allocatedLecturers.Supervisors));
            int t          = db.Modules.Max(ac => ac.MaxCount);


            if (db.AllocatedLecturers.Any(ac => ac.Supervisors.Equals(allocatedLecturers.Supervisors)) &&
                db.AllocatedLecturers.Any(acd => acd.Lecturers.Equals(allocatedLecturers.Lecturers)))
            {
                TempData["exists"] = "exists";
                return(RedirectToAction("Edit", "Groups1"));
            }

            if (t <= table_rows)
            {
                TempData["max"] = "max";
                return(RedirectToAction("fuc", "Groups1"));
            }

            if (ModelState.IsValid)
            {
                db.Entry(allocatedLecturers).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(allocatedLecturers));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "RegistrationNo,Name,Email,ContactNo,CGPA,Avatar,CV,Password")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "GroupID,ProjectID,Supervisor")] Group group)
 {
     if (ModelState.IsValid)
     {
         db.Entry(group).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(group));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "ProjectId,ModuleId,Name,Description,Client,PreferedTechnologies")] Project project)
 {
     if (ModelState.IsValid)
     {
         db.Entry(project).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(project));
 }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "id,Supervisors,Lecturers")] AllocatedLecturers allocatedLecturers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(allocatedLecturers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(allocatedLecturers));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "ClientId,Company,Name,Email,ContactNo")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
 public ActionResult Edit([Bind(Include = "Id,Account,RoleId")] SUserRole sUserRole)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sUserRole).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sUserRole));
 }
Esempio n. 10
0
 public ActionResult Edit([Bind(Include = "GroupID,ProjectID,Supervisor")] Group group)
 {
     if (db.Groups.Any(ac => ac.ProjectID.Equals(group.ProjectID)) && db.Groups.Any(acd => acd.Supervisor.Equals(group.Supervisor)))
     {
         TempData["exist)"] = "exist";
         return(RedirectToAction("Index", "Groups1"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(group).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(group));
 }
        public ActionResult Edit([Bind(Include = "RegistrationNo,Name,Email,ContactNo,CGPA,Avatar,CV")] Student student, HttpPostedFileBase Avatar, HttpPostedFileBase CV)
        {
            try
            {
                Session["UserName"] = student.Name;
                Session["Email"]    = student.Email;
                Session["CGPA"]     = student.CGPA;
                Session["CV"]       = student.CV;

                var extention1 = Path.GetExtension(Avatar.FileName);
                var extention2 = Path.GetExtension(CV.FileName);
                if (ModelState.IsValid && (extention2.Equals(".PDF") || extention2.Equals(".pdf")) && (extention1.Equals(".jpg") || extention1.Equals(".jpeg") || extention1.Equals(".GIF")))
                {
                    var      fileName1 = Path.GetFileName(CV.FileName);
                    var      path22    = Path.Combine(Server.MapPath("~/Content/Images2"), fileName1);
                    string[] path21    = path22.Split(new string[] { "SEP\\SEP" }, StringSplitOptions.None);
                    CV.SaveAs(path22);
                    student.CV = path21[MvcApplication.Pr_one] + "";

                    var      fileName = Path.GetFileName(Avatar.FileName);
                    var      path     = Path.Combine(Server.MapPath("~/Content/Images2"), fileName);
                    string[] path2    = path.Split(new string[] { "SEP\\SEP" }, StringSplitOptions.None);
                    Avatar.SaveAs(path);
                    student.Avatar = path2[MvcApplication.Pr_one] + "";

                    //Save the updated student model
                    db.Entry(student).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else if (!(extention2.Equals(".PDF") || extention2.Equals(".pdf")))
                {
                    TempData["error"] = "Please Use A Valid PDF";
                }
                else if (!(extention1.Equals(".jpg") || extention1.Equals(".jpeg") || extention1.Equals(".GIF")))
                {
                    TempData["Ava"] = "Please Use A Valid Avatar";
                }
            }
            catch (System.Data.Entity.Core.UpdateException)
            {
                TempData["Error"] = "Error Ocured while Updating the Database Context";
                throw;
            }
            return(View(student));
        }
Esempio n. 12
0
        public ActionResult Edit([Bind(Include = "LecturerId,Name,Email,ContactNo,Module,Qualification,Avatar")] Lecturer lecturer, HttpPostedFileBase Avatar)
        {
            try
            {
                lecturer.Qualification = "HOD";
                var extension = Path.GetExtension(Avatar.FileName);

                //To check the Model is Valid and the Image is Valid
                if (ModelState.IsValid && (extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".GIF")))
                {
                    string path = Server.MapPath("~/Content/Images2");

                    var fileName = Path.GetFileName(Avatar.FileName);
                    //Inserting the Image File
                    lecturer.Avatar = Validater.ImageUpload(Avatar, path);
                    //If the Changes are valid saving them to the DB
                    db.Entry(lecturer).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else if ((!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".GIF"))))
                {
                    Debug.Write("Invalid");
                    TempData["error"] = "Please Use A Valid Avatar";
                    return(View(lecturer));
                }
            }
            catch (System.NullReferenceException)
            {
                TempData["error"] = "Please Use A Valid Avatar";
            }

            if (!ModelState.IsValid)
            {
                Debug.Write("Invalid mate");
                return(View(lecturer));
            }
            return(ViewBag);
        }
        public ActionResult Edit([Bind(Include = "ProjectId,ModuleId,Name,Description,Client,PreferedTechnologies")] Project project)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.Entry(project).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception e)
                {
                    ViewBag.ModuleName = db.Modules;
                    return(View("error", new HandleErrorInfo(e, "Projects", "Edit")));

                    throw e;
                }
            }
            else
            {
                return(View(project));
            }
        }
Esempio n. 14
0
 public ActionResult Edit([Bind(Include = "LecturerId,Name,Email,ContactNo,Module,Qualification,Avatar")] Lecturer lecturer, HttpPostedFileBase Avatar)
 {
     if (ModelState.IsValid)
     {
         if (Avatar != null)
         {
             var ex = Path.GetExtension(Avatar.FileName);
             if (ex.Equals(".jpg") || ex.Equals(".jpeg") || ex.Equals(".GIF"))
             {
                 var      fileName = Path.GetFileName(Avatar.FileName);
                 var      path     = Path.Combine(Server.MapPath("~/Content/Images2"), fileName);
                 string[] path2    = path.Split(new string[] { "SEP\\SEP" }, StringSplitOptions.None);
                 Debug.Write(path2[1]);
                 Avatar.SaveAs(path);
                 lecturer.Avatar = path2[1] + "";
             }
         }
         db.Entry(lecturer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lecturer));
 }