private void BindControl() { DepMsts msts = new DepMsts(); DepMst obj = msts.Details(Convert.ToInt32(Request.QueryString["DID"].ToString())); txtdepartmentname.Text = obj.Dept_Name; }
public ActionResult DeleteConfirmed(int id) { DepMst depMst = db.DepMsts.Find(id); db.DepMsts.Remove(depMst); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Dept_ID,Dept_Name")] DepMst depMst) { if (ModelState.IsValid) { db.Entry(depMst).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(depMst)); }
public ActionResult Create([Bind(Include = "Dept_ID,Dept_Name")] DepMst depMst) { if (ModelState.IsValid) { db.DepMsts.Add(depMst); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(depMst)); }
// GET: DepMsts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DepMst depMst = db.DepMsts.Find(id); if (depMst == null) { return(HttpNotFound()); } return(View(depMst)); }
public String EditDep(DepMst objMst) { try { db.Entry(objMst).State = EntityState.Modified; db.SaveChanges(); return("0"); } catch (Exception ex) { return("1"); } finally { db.Dispose(); } }
public String CreateDep(DepMst objMst) { try { db.DepMsts.Add(objMst); db.SaveChanges(); return("0"); } catch (Exception ex) { return("1"); } finally { db.Dispose(); } }
public DepMst Details(int?id) { try { DepMst depMst = db.DepMsts.Find(id); return(depMst); } catch (Exception ex) { DepMst depMst = null; return(depMst); } finally { db.Dispose(); } }
public String DeleteDep(int id) { try { DepMst depMst = db.DepMsts.Find(id); db.DepMsts.Remove(depMst); db.SaveChanges(); return("0"); } catch (Exception ex) { return("1"); } finally { db.Dispose(); } }
protected void btnDepartment_Click(object sender, EventArgs e) { try { DepMst mst = new DepMst(); mst.Dept_Name = txtdepartmentname.Text.Trim(); DepMsts obj = new DepMsts(); String strerr = obj.CreateDep(mst); if (strerr == "0") { Response.Redirect("~/Department/DepDetails", false); } } catch (Exception ex) { } }
protected void btnDepartmentup_Click(object sender, EventArgs e) { try { DepMst mst = new DepMst(); mst.Dept_ID = Convert.ToInt32(Request.QueryString["DID"].ToString()); mst.Dept_Name = txtdepartmentname.Text.Trim(); DepMsts obj = new DepMsts(); String strerr = obj.EditDep(mst); if (strerr == "0") { Response.Redirect("~/Department/DepDetails", false); } } catch (Exception ex) { } }