Exemplo n.º 1
0
        public ActionResult Edit(tblEmployeeDetail employeeDetail, HttpPostedFileBase FileUploadEdit)
        {
            using (BusManagementContext db = new BusManagementContext())
            {
                //Save image in folder

                string FileName     = Path.GetFileName(FileUploadEdit.FileName);
                string SaveLocation = Server.MapPath("~/EmployeePicture/" + FileName);
                FileUploadEdit.SaveAs(SaveLocation);

                //save image name in database

                employeeDetail.employeeImage = "~/EmployeePicture/" + FileName;


                // byte image Save


                employeeDetail.employeePicture = new byte[FileUploadEdit.ContentLength];
                ViewBag.TeacherPicture         = FileUploadEdit.InputStream.Read(employeeDetail.employeePicture, 0, FileUploadEdit.ContentLength);


                db.Entry(employeeDetail).State = EntityState.Modified;
                db.SaveChanges();



                return(RedirectToAction("Index"));
            }
        }
 public ActionResult Edit([Bind(Include = "Id,Department,Designation")] VmDepartmentDesignation vmDepartmentDesignation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vmDepartmentDesignation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vmDepartmentDesignation));
 }