Example #1
0
        public ActionResult Edit([Bind(Include = "LessonID,LessonName,CourseID,Introduction,VideoURL,PDFfilename,IsActive")] HttpPostedFileBase PDF, Lesson lesson)
        {
            if (ModelState.IsValid)
            {
                if (PDF != null)
                {
                    string pdfFile = PDF.FileName;

                    string ext = pdfFile.Substring(pdfFile.LastIndexOf('.'));

                    string goodExts = ".pdf";

                    if (goodExts.Contains(ext.ToLower()))
                    {
                        //save file to webserver
                        PDF.SaveAs(Server.MapPath("~/Content/images/pdf/" + pdfFile));
                    }

                    lesson.PDFfilename = pdfFile;
                }

                db.Entry(lesson).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseID = new SelectList(db.Courses, "Course", "CourseName", lesson.CourseID);
            return(View(lesson));
        }
Example #2
0
        public ActionResult Edit([Bind(Include = "CourseID,CourseName,CourseDescription,isActive,Photo")] HttpPostedFileBase IMG, Cours cours)
        {
            if (ModelState.IsValid)
            {
                if (IMG != null)
                {
                    string pic = IMG.FileName;

                    string ext = pic.Substring(pic.LastIndexOf('.'));

                    string[] goodExts = { ".jpg", ".jpeg", ".png" };

                    if (goodExts.Contains(ext.ToLower()))
                    {
                        //save file to webserver
                        IMG.SaveAs(Server.MapPath("~/Content/images/fulls/" + pic));
                    }

                    cours.Photo = pic;
                }

                db.Entry(cours).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(cours));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "OwnerAssetID,AssetName,OwnerID,AssetPhoto,LevelID,SpecialNotes,IsActive,DateAdded")] OwnerAsset ownerAsset, HttpPostedFileBase assetPhoto)
 {
     if (ModelState.IsValid)
     {
         if (assetPhoto != null)
         {
             string   imgName  = assetPhoto.FileName;
             string   ext      = imgName.Substring(imgName.LastIndexOf('.'));
             string[] goodExts = { ".jpeg", ".jpg", ".png", ".gif" };
             if (goodExts.Contains(ext.ToLower()) && (assetPhoto.ContentLength <= 4194304))
             {
                 imgName = Guid.NewGuid() + ext;
                 assetPhoto.SaveAs(Server.MapPath("~/Content/img/" + imgName));
                 if (ownerAsset.AssetPhoto != null && ownerAsset.AssetPhoto != "NoImage.png")
                 {
                     System.IO.File.Delete(Server.MapPath("~/Content/Images/" + Session["currentImage"].ToString()));
                 }
                 ownerAsset.AssetPhoto = imgName;
             }
         }
         db.Entry(ownerAsset).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LevelID = new SelectList(db.Levels, "LevelID", "LevelName", ownerAsset.LevelID);
     ViewBag.OwnerID = new SelectList(db.UserDetails, "UserID", "FirstName", ownerAsset.OwnerID);
     return(View(ownerAsset));
 }
Example #4
0
        public ActionResult Edit([Bind(Include = "UserId,FirstName,LastName,Email,PhotoFileName,ResumeFilename")] UserDetail userDetail, HttpPostedFileBase resumeFile)
        {
            if (ModelState.IsValid)
            {
                #region File Upload
                string fileName = "";
                if (resumeFile != null)
                {
                    fileName = resumeFile.FileName;

                    string ext = fileName.Substring(fileName.LastIndexOf('.'));

                    string[] goodExts = { ".pdf", ".docx", ".txt", ".doc" };

                    if (goodExts.Contains(ext.ToLower()) /*&& (resumeFile.ContentLength <= 4194304)*/)
                    {
                        fileName = Guid.NewGuid() + ext;

                        string savePath = Server.MapPath("~/Content/img/resume/");
                        resumeFile.SaveAs(savePath + fileName);
                    }
                    else
                    {
                        fileName = "";
                    }
                    userDetail.ResumeFilename = fileName;
                }

                #endregion
                db.Entry(userDetail).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            return(View(userDetail));
        }
Example #5
0
 public ActionResult Edit([Bind(Include = "UserID,FirstName,LastName")] UserDetail userDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userDetail));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "LocationID,LocationName,InstructorName,Address,City,State,ZipCode")] Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(location));
 }
Example #7
0
 public ActionResult Edit([Bind(Include = "PositionId,Title,JobDescription")] Position position)
 {
     if (ModelState.IsValid)
     {
         db.Entry(position).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(position));
 }
Example #8
0
 public ActionResult Edit([Bind(Include = "CourseCompletionId,Userid,CourseID,DateCompleted")] CourseCompletion courseCompletion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(courseCompletion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(courseCompletion));
 }
Example #9
0
 public ActionResult Edit([Bind(Include = "LevelID,LevelName,Description")] Level level)
 {
     if (ModelState.IsValid)
     {
         db.Entry(level).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(level));
 }
Example #10
0
 public ActionResult Edit([Bind(Include = "ApplicationStatusId,StatusName,StatusDescription")] ApplicationStatu applicationStatu)
 {
     if (ModelState.IsValid)
     {
         db.Entry(applicationStatu).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(applicationStatu));
 }
Example #11
0
 public ActionResult Edit([Bind(Include = "LocationId,StoreNumber,City,State,ManagerId")] Location location)
 {
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ManagerId = new SelectList(db.UserDetails, "UserId", "FirstName", location.ManagerId);
     return(View(location));
 }
Example #12
0
 public ActionResult Edit([Bind(Include = "ClassID,ClassName,Description,ClassDate,LevelRequired,ClassLimit")] ClassInfo classInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(classInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LevelRequired = new SelectList(db.Levels, "LevelID", "LevelName", classInfo.LevelRequired);
     return(View(classInfo));
 }
Example #13
0
 public ActionResult Edit([Bind(Include = "UserID,FirstName,LastName,CourseCompletetionID")] UserDetail userDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseCompletetionID = new SelectList(db.CourseCompletions, "CourseCompletionId", "Userid");
     return(View(userDetail));
 }
Example #14
0
 public ActionResult Edit([Bind(Include = "OpenPositionId,PositionId,LocationId")] OpenPosition openPosition)
 {
     if (ModelState.IsValid)
     {
         db.Entry(openPosition).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "StoreNumber", openPosition.LocationId);
     ViewBag.PositionId = new SelectList(db.Positions, "PositionId", "Title", openPosition.PositionId);
     return(View(openPosition));
 }
Example #15
0
 public ActionResult Edit([Bind(Include = "LessonViewID,UserID,LessonID,DateViewed")] LessonView lessonView)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lessonView).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LessonID = new SelectList(db.Lessons, "LessonID", "LessonName", lessonView.LessonID);
     ViewBag.UserID   = new SelectList(db.UserDetails, "UserID", "FirstName", lessonView.UserID);
     return(View(lessonView));
 }
Example #16
0
 public ActionResult Edit([Bind(Include = "ReservationID,OwnerAssetID,LocationID,ClassID")] Reservation reservation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reservation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ReservationSearch"));
     }
     ViewBag.ClassID      = new SelectList(db.ClassInfoes, "ClassID", "ClassName", reservation.ClassID);
     ViewBag.LocationID   = new SelectList(db.Locations, "LocationID", "LocationName", reservation.LocationID);
     ViewBag.OwnerAssetID = new SelectList(db.OwnerAssets, "OwnerAssetID", "AssetName", reservation.OwnerAssetID);
     return(View(reservation));
 }
Example #17
0
 public ActionResult Edit([Bind(Include = "ApplicationId,OpenPositionId,UserId,ApplicationDate,ManagerNote,ApplicationStatus,ResumeFilename")] Application application)
 {
     if (ModelState.IsValid)
     {
         db.Entry(application).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ApplicationStatus = new SelectList(db.ApplicationStatus, "ApplicationStatusId", "StatusName", application.ApplicationStatus);
     ViewBag.OpenPositionId    = new SelectList(db.OpenPositions, "OpenPositionId", "OpenPositionId", application.OpenPositionId);
     ViewBag.UserId            = new SelectList(db.UserDetails, "UserId", "FirstName", application.UserId);
     return(View(application));
 }