public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] ExhibitionCoordinatorMaster exhibitionCoordinatorMaster) { if (id != exhibitionCoordinatorMaster.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(exhibitionCoordinatorMaster); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExhibitionCoordinatorMasterExists(exhibitionCoordinatorMaster.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(exhibitionCoordinatorMaster)); }
protected void btnSubmit_Click(object sender, EventArgs e) { ExhibitionCoordinatorMaster Obj_Add_Coor = new ExhibitionCoordinatorMaster { Name = name.Text, }; ExhibitionMasterBuss.SaveCoordinators(Obj_Add_Coor); CoordinatorFill(); }
protected void btnUpdate_Click(object sender, EventArgs e) { ExhibitionCoordinatorMaster Coordinator = new ExhibitionCoordinatorMaster { ID = Convert.ToInt32(ddl_Coordinator.SelectedValue), Name = coordinator.Text, }; ExhibitionMasterBuss.UpdateCoordinator(Coordinator); CoordinatorFill(); }
public async Task <IActionResult> Create([Bind("ID,Name")] ExhibitionCoordinatorMaster exhibitionCoordinatorMaster) { if (ModelState.IsValid) { _context.Add(exhibitionCoordinatorMaster); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(exhibitionCoordinatorMaster)); }
public async Task <IActionResult> Create([Bind("ID,ClassMasterID,Name")] ExhibitionCoordinatorMaster exhibitionCoordinatorMaster) { if (ModelState.IsValid) { _context.Add(exhibitionCoordinatorMaster); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClassMasterID"] = new SelectList(_context.ClassMasters, "ID", "ClassName", exhibitionCoordinatorMaster.ClassMasterID); return(View(exhibitionCoordinatorMaster)); }
public static void SaveCoordinators(ExhibitionCoordinatorMaster Obj_Coordinator_Save)//save coordinator method. { try { using (SchoolExhibitionEntities db = new SchoolExhibitionEntities()) { db.ExhibitionCoordinatorMasters.Add(Obj_Coordinator_Save); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public static int UpdateCoordinator(ExhibitionCoordinatorMaster Obj_Coordinator_Update)//update method { try { using (SchoolExhibitionEntities db = new SchoolExhibitionEntities()) { ExhibitionCoordinatorMaster c = db.ExhibitionCoordinatorMasters.SingleOrDefault(x => x.ID == Obj_Coordinator_Update.ID);//Lambda expression c.Name = Obj_Coordinator_Update.Name; db.SaveChanges(); return(Obj_Coordinator_Update.ID); } } catch (Exception ex) { throw ex; } }
public static void DeleteCoordinator(string Obj_Coordinator_Delete)//Delete method { try { using (SchoolExhibitionEntities db = new SchoolExhibitionEntities()) { ExhibitionCoordinatorMaster c = db.ExhibitionCoordinatorMasters.SingleOrDefault(x => x.ID.ToString().Trim() == Obj_Coordinator_Delete.Trim());//Lambda expression if (c != null) { db.ExhibitionCoordinatorMasters.Remove(c); db.SaveChanges(); } } } catch (Exception ex) { throw ex; } }