public async Task <IActionResult> Edit(int id, [Bind("SectionId,Name")] tblSection tblSection) { if (id != tblSection.SectionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblSection); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tblSectionExists(tblSection.SectionId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tblSection)); }
// GET: /Users/ public ActionResult Index(int isdelete = 0, int restoreid = 0) { var list = (dynamic)null; TempData["restore"] = ""; if (isdelete == 0) { if (restoreid > 0) { if (db.tblSection.Any(a => a.SectionID == restoreid && a.IsDelete == true)) { tblSection tblSection = db.tblSection.Find(restoreid); tblSection.IsDelete = false; db.Entry(tblSection).State = EntityState.Modified; db.SaveChanges(); TempData["msg"] = "Record Restore Successfully"; // return View("Index","Section"); } } list = db.tblSection.Where(a => a.IsDelete != true).OrderByDescending(a => a.SectionID).ToList(); } else { TempData["restore"] = "restore"; list = db.tblSection.Where(a => a.IsDelete == true).OrderByDescending(a => a.SectionID).ToList(); } return(View(list)); }
public ActionResult DeleteConfirmed(int id) { tblSection tblSection = db.tblSection.Find(id); db.tblSection.Remove(tblSection); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Update(tblSection section) { if (ModelState.IsValid) { db.Entry(section).State = EntityState.Modified; db.SaveChanges(); } return(Json(section, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(tblSection section) { if (ModelState.IsValid) { db.tblSections.Add(section); db.SaveChanges(); } return(Json(section, JsonRequestBehavior.AllowGet)); }
public ActionResult Create([Bind(Include = "SectionID,SectionName,Password,CreatedBy,UpdatedBy,CreateDate,UpdateDate,IsLogin,IsDelete,IsActive,RoleID,SchoolID,DeleteBy,DeleteDate")] tblSection tblSection) { if (ModelState.IsValid) { db.tblSection.Add(tblSection); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblSection)); }
public ActionResult Edit([Bind(Include = "SectionID,SectionName,ClassID")] tblSection tblSection) { if (ModelState.IsValid) { db.Entry(tblSection).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassID = new SelectList(db.tblClasses, "ClassID", "ClassName", tblSection.ClassID); return(View(tblSection)); }
public async Task <IActionResult> Create([Bind("SectionId,Name")] tblSection tblSection) { if (ModelState.IsValid) { _context.Add(tblSection); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tblSection)); }
public ActionResult Edit([Bind(Include = "SectionID,SectionName,Password,CreatedBy,UpdatedBy,CreateDate,UpdateDate,IsLogin,IsDelete,IsActive,RoleID,SchoolID,DeleteBy,DeleteDate")] tblSection tblSection) { if (ModelState.IsValid) { db.Entry(tblSection).State = EntityState.Modified; db.SaveChanges(); TempData["msg"] = "Record Update Successfully"; return(RedirectToAction("Index")); } return(View(tblSection)); }
// GET: Sections/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblSection tblSection = db.tblSections.Find(id); if (tblSection == null) { return(HttpNotFound()); } return(View(tblSection)); }
private void btnView_Click(object sender, RoutedEventArgs e) { try { object rowDep = lupeditDep.SelectedItem; tblDepartment iDep = (tblDepartment)rowDep; object rowSec = lupeditSec.SelectedItem; tblSection iSec = (tblSection)rowSec; object rowGro = lupeditGroup.SelectedItem; tblGroup iGro = (tblGroup)rowGro; if (colFromDate.DateTime != null && colToDate.DateTime != null) { int depID = -1; if (iDep != null) { depID = iDep.DepartmentID; } int secID = -1; if (iSec != null) { secID = iSec.SectionID; } int groID = -1; if (iGro != null) { groID = iGro.GroupID; } string empID = "-1"; if (txtEmpId.GetID().EmployeeID != null) { empID = txtEmpId.GetID().EmployeeID; } websv.CheckTimeListAsync(colFromDate.DateTime, colToDate.DateTime, depID, secID, groID, empID, ckbNormal.IsChecked.Value, ckbNoTimeInHasTimeOut.IsChecked.Value, ckbHasTimeInNoTimeOut.IsChecked.Value, ckbNoTimeInNoTimeOut.IsChecked.Value, ckbWorkOnHoliday.IsChecked.Value, ckbLeave.IsChecked.Value, ckbHoliday.IsChecked.Value, 3); //panelThietLap.Closed = true; gridCheckTimeList.View.ShowTotalSummary = true; gridCheckTimeList.View.ShowFixedTotalSummary = true; tblView.SelectAll(); //lblTest.Content = gridCheckTimeList.VisibleRowCount.ToString(); //hide panel Layout1.DockController.Hide(panelThietLap); gridCheckTimeList.Focus(); } } catch (Exception) { throw new Exception(); } }
// GET: Sections/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblSection tblSection = db.tblSections.Find(id); if (tblSection == null) { return(HttpNotFound()); } ViewBag.ClassID = new SelectList(db.tblClasses, "ClassID", "ClassName", tblSection.ClassID); return(View(tblSection)); }
public ActionResult Create([Bind(Include = "SectionID,SectionName,ReportingDateTime,ClassID")] tblSection tblSection) { if (ModelState.IsValid) { tblSection.SectionActive = true; tblSection.ReportingDateTime = DateTime.Now; db.tblSections.Add(tblSection); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassID = new SelectList(db.tblClasses, "ClassID", "ClassName", tblSection.ClassID); return(View(tblSection)); }
// GET: /Users/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblSection tblSection = db.tblSection.Find(id); ViewBag.RoleID = new SelectList(db.tblRoles, "RoleID", "RoleName", tblSection.SectionID); ViewBag.SchoolID = new SelectList(db.tblSchool, "SchoolID", "SchoolName", tblSection.SchoolID); if (tblSection == null) { return(HttpNotFound()); } return(View(tblSection)); }
public HttpResponseMessage Put([Bind(Include = "Sec_Name,Model")] SectionViewModel svm) { AssignmentManagementSystemEntities db = new AssignmentManagementSystemEntities(); var section = secDB.ListAll().Find(s => s.Id.Equals(svm.Id)); string message = "Section Updated Successfully"; tblSection tb = db.tblSections.Where(s => s.Section_Id == svm.Id).FirstOrDefault(); bool isexists = secDB.CheckSectionNameExist(svm.Sec_Name); if (isexists) { if (tb.Sec_Name == svm.Sec_Name) { if (ModelState.IsValid) { secDB.Update(svm); return(Request.CreateResponse(HttpStatusCode.OK, message)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } } else { ModelState.AddModelError("Sec_Name", "Section Name Already Exist"); } } if (ModelState.IsValid) { secDB.Update(svm); return(Request.CreateResponse(HttpStatusCode.OK, message)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
public Response SaveSectionMasterDetails(SectionMasterCustomModel objModel) { using (response = new Response()) { using (dbcontext = new SchoolManagementEntities()) { try { response.success = true; if (objModel.SectionId == 0) { var rs = dbcontext.tblSections.FirstOrDefault(x => x.IsDeleted == false && x.Title == objModel.Title && x.ClassId == objModel.ClassId); if (rs == null) { tblSection objAddNew = new tblSection { ClassId = objModel.ClassId, SchoolId = Convert.ToInt32(CommonHelper.TaskSchoolId.SchoolId), Title = objModel.Title, ShortDescription = objModel.ShortDescription, DDate = objModel.DDate, IsActive = true, IsDeleted = false, CreatedBy = objModel.CreatedBy, CreatedDate = DateTime.Now, ModifiedBy = objModel.ModifiedBy, ModifiedDate = DateTime.Now }; dbcontext.tblSections.Add(objAddNew); dbcontext.SaveChanges(); response.responseData = new { SectionId = objAddNew.SectionId, Title = objAddNew.Title }; response.message = "Record Added Successfully!"; } else { response.success = false; response.message = "Record Already Exists!"; } } else { var rs = dbcontext.tblSections.FirstOrDefault(x => x.IsDeleted == false && x.ClassId == objModel.ClassId && x.Title == objModel.Title && x.SectionId != objModel.SectionId); if (rs == null) { var objUpdate = dbcontext.tblSections.FirstOrDefault(m => m.SectionId == objModel.SectionId); if (objUpdate != null) { objUpdate.ClassId = objModel.ClassId; objUpdate.Title = objModel.Title; objUpdate.ShortDescription = objModel.ShortDescription; objUpdate.DDate = objModel.DDate; objUpdate.ModifiedBy = objModel.ModifiedBy; objUpdate.ModifiedDate = DateTime.Now; dbcontext.SaveChanges(); response.responseData = new { SectionId = objUpdate.SectionId, Title = objUpdate.Title }; response.message = "Record Updated Successfully!"; } } else { response.success = false; response.message = "Record Already Exists!"; } } return(response); } catch (Exception ex) { response.success = false; response.message = ex.Message; return(response); } } } }