public ActionResult SaveStudent(string Name) { tbl_StudentMaster abc = new tbl_StudentMaster(); abc.FullName = Name; _student.Add(abc); int id = _student.GetAll().Max(x => x.pkid); return(Json(id, JsonRequestBehavior.AllowGet)); }
public ActionResult AddStudent(tbl_StudentMasterss model, HttpPostedFileBase Mcopy, HttpPostedFileBase BIODATA, HttpPostedFileBase Medicalcer) { WebFunction web = new WebFunction(); string exception = ""; try { if (model.pkid == 0) { tbl_StudentMaster abc = new tbl_StudentMaster(); if (Mcopy != null) { abc.Movement_copy = web.Storefile(Mcopy, 2); } if (BIODATA != null) { abc.BIODataForm = web.Storefile(BIODATA, 2); } if (Medicalcer != null) { abc.MedicalCertificate = web.Storefile(Medicalcer, 2); } abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.UserName = model.UserName; abc.Password = model.Password; abc.ConfirmedPassword = model.ConfirmedPassword; abc.CommisionNo = model.CommisionNo; abc.DateComm = model.DateComm; abc.Rank = model.Rank; abc.FullName = model.FullName; abc.DateOfBirth = model.DateOfBirth; abc.PlaceOfBirth = model.PlaceOfBirth; abc.IdentificationMarks = model.IdentificationMarks; abc.Height = model.Height; abc.Weight = model.Weight; abc.ColorOfEye = model.ColorOfEye; abc.ColorOfHair = model.ColorOfHair; abc.Religion = model.Religion; abc.Caste = model.Caste; abc.Nationality = model.Nationality; abc.UnitAndLocation = model.UnitAndLocation; abc.HQGroup = model.HQGroup; abc.Directorate = model.Directorate; abc.State = model.State; abc.CourseSeries = model.CourseSeries; abc.ChestNo = model.ChestNo; abc.DUCFrom = model.DUCFrom; abc.DUCTo = model.DUCTo; abc.ArrivalInNCCOTA = model.ArrivalInNCCOTA; abc.MotherToughe = model.MotherToughe; abc.PresentAddress = model.PresentAddress; abc.ParmanentAddress = model.ParmanentAddress; abc.MaritalStatus = model.MaritalStatus; abc.NOKFullName = model.NOKFullName; abc.NOKAddress = model.NOKAddress; abc.NOKRelation = model.NOKRelation; abc.TeachingInstitideName = model.TeachingInstitideName; abc.TeachingSubject = model.TeachingSubject; abc.TeachingDateOfEmplyment = model.TeachingDateOfEmplyment; abc.TeachingEmpStatus = model.TeachingEmpStatus; abc.NCCorOTUMember = model.NCCorOTUMember; abc.WhichDivision = model.WhichDivision; abc.WhichForce = model.WhichForce; abc.TrainingPeriod = model.TrainingPeriod; abc.RankofNCC = model.RankofNCC; abc.MedicallyExamined = model.MedicallyExamined; abc.AlimentName = model.AlimentName; abc.MovementOrderNo = model.MovementOrderNo; abc.MovementDate = model.MovementDate; abc.Games = model.Games; abc.OtherQualification = model.OtherQualification; abc.ReadNCCActRules = model.ReadNCCActRules; abc.ReadNCCorDG = model.ReadNCCorDG; abc.ReadSyllabus = model.ReadSyllabus; abc.ReadHandbook = model.ReadHandbook; abc.ReadNCCCompPlanning = model.ReadNCCCompPlanning; abc.ReadNCCCompInstruction = model.ReadNCCCompInstruction; abc.DateOfPreCourseTraining = model.DateOfPreCourseTraining; abc.Place = model.Place; abc.AddedDate = DateTime.Now; _student.Add(abc); exception = "Save Successfully"; } else { int _id = Convert.ToInt32(model.pkid); tbl_StudentMaster abc = _student.Get(_id); if (Mcopy != null) { if (model.Movement_copy != null) { web.DeleteImage(model.Movement_copy); } abc.Movement_copy = web.Storefile(Mcopy, 2); } if (BIODATA != null) { if (model.BIODataForm != null) { web.DeleteImage(model.BIODataForm); } abc.BIODataForm = web.Storefile(BIODATA, 2); } if (Medicalcer != null) { if (model.MedicalCertificate != null) { web.DeleteImage(model.MedicalCertificate); } abc.MedicalCertificate = web.Storefile(Medicalcer, 2); } abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.UserName = model.UserName; abc.Password = model.Password; abc.ConfirmedPassword = model.ConfirmedPassword; abc.CommisionNo = model.CommisionNo; abc.DateComm = model.DateComm; abc.Rank = model.Rank; abc.FullName = model.FullName; abc.DateOfBirth = model.DateOfBirth; abc.PlaceOfBirth = model.PlaceOfBirth; abc.IdentificationMarks = model.IdentificationMarks; abc.Height = model.Height; abc.Weight = model.Weight; abc.ColorOfEye = model.ColorOfEye; abc.ColorOfHair = model.ColorOfHair; abc.Religion = model.Religion; abc.Caste = model.Caste; abc.Nationality = model.Nationality; abc.UnitAndLocation = model.UnitAndLocation; abc.HQGroup = model.HQGroup; abc.Directorate = model.Directorate; abc.State = model.State; abc.CourseSeries = model.CourseSeries; abc.ChestNo = model.ChestNo; abc.DUCFrom = model.DUCFrom; abc.DUCTo = model.DUCTo; abc.ArrivalInNCCOTA = model.ArrivalInNCCOTA; abc.MotherToughe = model.MotherToughe; abc.PresentAddress = model.PresentAddress; abc.ParmanentAddress = model.ParmanentAddress; abc.MaritalStatus = model.MaritalStatus; abc.NOKFullName = model.NOKFullName; abc.NOKAddress = model.NOKAddress; abc.NOKRelation = model.NOKRelation; abc.TeachingInstitideName = model.TeachingInstitideName; abc.TeachingSubject = model.TeachingSubject; abc.TeachingDateOfEmplyment = model.TeachingDateOfEmplyment; abc.TeachingEmpStatus = model.TeachingEmpStatus; abc.NCCorOTUMember = model.NCCorOTUMember; abc.WhichDivision = model.WhichDivision; abc.WhichForce = model.WhichForce; abc.TrainingPeriod = model.TrainingPeriod; abc.RankofNCC = model.RankofNCC; abc.MedicallyExamined = model.MedicallyExamined; abc.AlimentName = model.AlimentName; abc.MovementOrderNo = model.MovementOrderNo; abc.MovementDate = model.MovementDate; abc.Games = model.Games; abc.OtherQualification = model.OtherQualification; abc.ReadNCCActRules = model.ReadNCCActRules; abc.ReadNCCorDG = model.ReadNCCorDG; abc.ReadSyllabus = model.ReadSyllabus; abc.ReadHandbook = model.ReadHandbook; abc.ReadNCCCompPlanning = model.ReadNCCCompPlanning; abc.ReadNCCCompInstruction = model.ReadNCCCompInstruction; abc.DateOfPreCourseTraining = model.DateOfPreCourseTraining; abc.Place = model.Place; abc.AddedDate = DateTime.Now; _student.Update(abc); exception = "Updated Successfully"; } return(RedirectToAction("StudentMaster", "Student", new { Exception = exception })); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); exception = e.Message; return(RedirectToAction("StudentMaster", "Student", new { Exception = exception })); } }
public ActionResult AddStudent(string id, string Exception) { ViewBag.Exception = Exception; ViewBag.CourseList = new SelectList(_course.GetAll(), "pkid", "CourseName"); ViewBag.DivisionList = new SelectList(_division.GetAll(), "pkid", "DivisioName"); ViewBag.ForceList = new SelectList(_force.GetAll(), "pkid", "ForceName"); if (!String.IsNullOrWhiteSpace(id)) { int _id = Convert.ToInt32(id); tbl_StudentMaster model = _student.Get(_id); tbl_StudentMasterss abc = new tbl_StudentMasterss(); abc.pkid = model.pkid; abc.Course_fkid = model.Course_fkid; abc.Division_fkid = model.Division_fkid; abc.Force_fkid = model.Force_fkid; abc.UserName = model.UserName; abc.Password = model.Password; abc.ConfirmedPassword = model.ConfirmedPassword; abc.CommisionNo = model.CommisionNo; abc.DateComm = model.DateComm; abc.Rank = model.Rank; abc.FullName = model.FullName; abc.DateOfBirth = model.DateOfBirth; abc.PlaceOfBirth = model.PlaceOfBirth; abc.IdentificationMarks = model.IdentificationMarks; abc.Height = model.Height; abc.Weight = model.Weight; abc.ColorOfEye = model.ColorOfEye; abc.ColorOfHair = model.ColorOfHair; abc.Religion = model.Religion; abc.Caste = model.Caste; abc.Nationality = model.Nationality; abc.UnitAndLocation = model.UnitAndLocation; abc.HQGroup = model.HQGroup; abc.Directorate = model.Directorate; abc.State = model.State; abc.CourseSeries = model.CourseSeries; abc.ChestNo = model.ChestNo; abc.DUCFrom = model.DUCFrom; abc.DUCTo = model.DUCTo; abc.ArrivalInNCCOTA = model.ArrivalInNCCOTA; abc.MotherToughe = model.MotherToughe; abc.PresentAddress = model.PresentAddress; abc.ParmanentAddress = model.ParmanentAddress; abc.MaritalStatus = model.MaritalStatus; abc.NOKFullName = model.NOKFullName; abc.NOKAddress = model.NOKAddress; abc.NOKRelation = model.NOKRelation; abc.TeachingInstitideName = model.TeachingInstitideName; abc.TeachingSubject = model.TeachingSubject; abc.TeachingDateOfEmplyment = model.TeachingDateOfEmplyment; abc.TeachingEmpStatus = model.TeachingEmpStatus; abc.NCCorOTUMember = model.NCCorOTUMember; abc.WhichDivision = model.WhichDivision; abc.WhichForce = model.WhichForce; abc.TrainingPeriod = model.TrainingPeriod; abc.RankofNCC = model.RankofNCC; abc.MedicallyExamined = model.MedicallyExamined; abc.MedicalCertificate = model.MedicalCertificate; abc.AlimentName = model.AlimentName; abc.MovementOrderNo = model.MovementOrderNo; abc.MovementDate = model.MovementDate; abc.Movement_copy = model.Movement_copy; abc.Games = model.Games; abc.OtherQualification = model.OtherQualification; abc.ReadNCCActRules = model.ReadNCCActRules; abc.ReadNCCorDG = model.ReadNCCorDG; abc.ReadSyllabus = model.ReadSyllabus; abc.ReadHandbook = model.ReadHandbook; abc.ReadNCCCompPlanning = model.ReadNCCCompPlanning; abc.ReadNCCCompInstruction = model.ReadNCCCompInstruction; abc.DateOfPreCourseTraining = model.DateOfPreCourseTraining; abc.BIODataForm = model.BIODataForm; abc.Place = model.Place; abc.AddedDate = DateTime.Now; return(View(abc)); } return(View()); }