Esempio n. 1
0
 public ActionResult EditEmployeeDocuments(EmployeeDocument employeedocument, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         if (file != null)
         {
             string fileName  = Path.GetFileNameWithoutExtension(file.FileName);
             string extension = Path.GetExtension(file.FileName);
             fileName = fileName + DateTime.Now.ToString("yymmdd") + extension;
             employeedocument.FilePath = "~/Image/" + fileName;
             fileName = Path.Combine(Server.MapPath("~/Image/"), fileName);
             file.SaveAs(Path.Combine(fileName));
             employeedocument.FilePath = fileName;
         }
         using (EMSDbContext dc = new EMSDbContext())
         {
             dc.Entry(employeedocument).State = EntityState.Modified;
             dc.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.FileStatus = "File edit successfully.";
     }
     ViewBag.DocumentTypeId = new SelectList(db.DocumentTypes, "Id", "TypeName", employeedocument.DocumentTypeId);
     ViewBag.EmployeeId     = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeedocument.EmployeeId);
     return(View(employeedocument));
 }
Esempio n. 2
0
 public ActionResult SaveCountry(Country country)
 {
     if (ModelState.IsValid)
     {
         if (country.Id != 0)
         {
             db.Entry(country).State = EntityState.Modified;
         }
         else
         {
             db.Countries.Add(country);
         }
         db.SaveChanges();
         return(RedirectToAction("SaveCountry"));
     }
     return(View(country));
 }
 public ActionResult EditCertification(Certification certification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(certification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewCertificate"));
     }
     return(View(certification));
 }
Esempio n. 4
0
 public ActionResult EditDepartment(Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewAllDepartment"));
     }
     return(View(department));
 }
Esempio n. 5
0
 public ActionResult EditLanguage(Language language)
 {
     if (ModelState.IsValid)
     {
         db.Entry(language).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewLanguage"));
     }
     return(View(language));
 }
Esempio n. 6
0
 public ActionResult EditEducation(Education education)
 {
     if (ModelState.IsValid)
     {
         db.Entry(education).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEducation"));
     }
     return(View(education));
 }
Esempio n. 7
0
 public ActionResult EditDocumentType(DocumentType documentType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(documentType).State = EntityState.Modified;
         db.SaveChanges();
         ViewBag.Message = "Documents type Successfully Edited";
     }
     return(View(documentType));
 }
Esempio n. 8
0
 public ActionResult EditSkill([Bind(Include = "Id,SkillName,Description")] Skill skill)
 {
     if (ModelState.IsValid)
     {
         db.Entry(skill).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewSkill"));
     }
     return(View(skill));
 }
 public ActionResult EditDesignation(Designation designation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(designation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewDesignation"));
     }
     return(View(designation));
 }
Esempio n. 10
0
 public ActionResult EditDistrict([Bind(Include = "Id,DivisionId,DistrictCode,DistrictName")] District district)
 {
     if (ModelState.IsValid)
     {
         db.Entry(district).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DivisionId = new SelectList(db.Divisions, "Id", "DivisionName", district.DivisionId);
     return(View(district));
 }
Esempio n. 11
0
 public ActionResult EditDivsion([Bind(Include = "Id,CountryId,DivisionCode,DivisionName")] Division division)
 {
     if (ModelState.IsValid)
     {
         db.Entry(division).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryId = new SelectList(db.Countries, "Id", "CountryCode", division.CountryId);
     return(View(division));
 }
Esempio n. 12
0
 public ActionResult EditExam(Exam exam)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exam).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewExam"));
     }
     ViewBag.EducationId = new SelectList(db.Educations, "Id", "EducationName", exam.EducationId);
     return(View(exam));
 }
Esempio n. 13
0
 public ActionResult EditPoliceStation([Bind(Include = "Id,DistrictId,PoliceStationCode,PoliceStationName")] PoliceStation policestation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(policestation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewAllPoliceSation"));
     }
     ViewBag.DistrictId = new SelectList(db.Districts, "Id", "DistrictName", policestation.DistrictId);
     return(View(policestation));
 }
 public ActionResult EditTrainingHistory([Bind(Include = "Id,EmployeeId,TrainingTitle,TrainingTopic,TrainingInstitute,IstituteLocation,InstituteCountry,TrainingYear,TrainingDuration")] EmployeeTrainingHistory employeetraininghistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeetraininghistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewTrainingHistory"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeetraininghistory.EmployeeId);
     return(View(employeetraininghistory));
 }
Esempio n. 15
0
 public ActionResult EditUnion([Bind(Include = "Id,PoliceStationId,UnionCode,UnionName")] Union union)
 {
     if (ModelState.IsValid)
     {
         db.Entry(union).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewAllUnion"));
     }
     ViewBag.PoliceStationId = new SelectList(db.PoliceStations, "Id", "PoliceStationName", union.PoliceStationId);
     return(View(union));
 }
 public ActionResult EditEmployeeCertification([Bind(Include = "Id,EmployeeId,CertificationId,InstituteName,FromDate,ToDate")] EmployeeCertification employeecertification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeecertification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmployeeCertification"));
     }
     ViewBag.EmployeeId      = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeecertification.EmployeeId);
     ViewBag.CertificationId = new SelectList(db.Certifications, "Id", "CertificationName", employeecertification.CertificationId);
     return(View(employeecertification));
 }
 public ActionResult EditEmployeeSkill([Bind(Include = "Id,EmployeeId,SkillId,Details")] EmployeeSkill employeeskill)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeskill).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmployeeSkill"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeeskill.EmployeeId);
     ViewBag.SkillId    = new SelectList(db.Skills, "Id", "SkillName", employeeskill.SkillId);
     return(View(employeeskill));
 }
Esempio n. 18
0
 public ActionResult EditEmployeeLanguage([Bind(Include = "Id,EmployeeId,LanguageId,Reading,Speaking,Writing,Understanding")] EmployeeLanguage employeelanguage)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeelanguage).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmployeeLanguage"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeelanguage.EmployeeId);
     ViewBag.LanguageId = new SelectList(db.Languages, "Id", "LanguageName", employeelanguage.LanguageId);
     return(View(employeelanguage));
 }
Esempio n. 19
0
 public ActionResult EditEmployeeEducation([Bind(Include = "Id,EmployeeId,EducationId,ExamId,Subject,InstituteName,FromDate,ToDate,Duration,PassingYear")] EmployeEducation employeeducation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeducation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmployeeEducation"));
     }
     ViewBag.EducationId = new SelectList(db.Educations, "Id", "EducationName", employeeducation.EducationId);
     ViewBag.EmployeeId  = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeeducation.EmployeeId);
     ViewBag.ExamId      = new SelectList(db.Exams, "Id", "ExamName", employeeducation.ExamId);
     return(View(employeeducation));
 }
 public ActionResult EditEmploymentHistory([Bind(Include = "Id,EmployeeId,CompanyName,CompanyLocation,DepartmentId,DesignationId,EmploymentFromDate,IsCurrentEmployee,EmploymentToDate,Responsibilities")] EmploymentHistory employmenthistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employmenthistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmploymentHistory"));
     }
     ViewBag.DepartmentId  = new SelectList(db.Departments, "Id", "DepartmentCode", employmenthistory.DepartmentId);
     ViewBag.DesignationId = new SelectList(db.Designations, "Id", "DesignationCode", employmenthistory.DesignationId);
     ViewBag.EmployeeId    = new SelectList(db.Employees, "Id", "EmployeeRegNo", employmenthistory.EmployeeId);
     return(View(employmenthistory));
 }
Esempio n. 21
0
 public ActionResult EditEmployee(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("ViewEmployee"));
     }
     ViewBag.CountryId       = new SelectList(db.Countries, "Id", "CountryCode", employee.CountryId);
     ViewBag.DepartmentId    = new SelectList(db.Departments, "Id", "DepartmentCode", employee.DepartmentId);
     ViewBag.DesignationId   = new SelectList(db.Designations, "Id", "DesignationCode", employee.DesignationId);
     ViewBag.DistrictId      = new SelectList(db.Districts, "Id", "DistrictCode", employee.DistrictId);
     ViewBag.DivisionId      = new SelectList(db.Divisions, "Id", "DivisionCode", employee.DivisionId);
     ViewBag.PoliceStationId = new SelectList(db.PoliceStations, "Id", "PoliceStationCode", employee.PoliceStationId);
     ViewBag.UnionId         = new SelectList(db.Unions, "Id", "UnionCode", employee.UnionId);
     return(View(employee));
 }