protected void btnSave_Click(object sender, EventArgs e) { tbl_OfficeInfo atbl_OfficeInfo = new tbl_OfficeInfo(); atbl_OfficeInfo.Office_Name = txtOfficeName.Text; int count = (from emp in _context.tbl_OfficeInfo where emp.Office_Name == atbl_OfficeInfo.Office_Name select emp.Office_Name).Count(); if (btnSave.Text == "Save") { if (count > 0) { lblMessage.Visible = true; lblMessage.Text = "E-ID already exists!"; return; } aOfficeSetup_BLL.SaveOffice(atbl_OfficeInfo); lblMessage.Visible = true; lblMessage.Text = "Data Save Successfully"; } else { aOfficeSetup_BLL.UpdateOffice(atbl_OfficeInfo, Convert.ToInt16(hdnofficeID.Value)); lblMessage.Visible = true; lblMessage.Text = "Data Update Successfully"; btnCancel.Visible = false; btnSave.Text = "Save"; } Clearform(); GetAllOfficeDetails(); }
internal int UpdateOffice(tbl_OfficeInfo atbl_OfficeInfo, int Office_Id) { tbl_OfficeInfo objtbl_OfficeInfo = _context.tbl_OfficeInfo.First(x => x.Office_Id == Office_Id); objtbl_OfficeInfo.Office_Name = atbl_OfficeInfo.Office_Name; _context.SaveChanges(); return(1); }
internal int UpdateOffice(tbl_OfficeInfo atbl_OfficeInfo, int Office_Id) { return(aOfficeSetup_DAL.UpdateOffice(atbl_OfficeInfo, Office_Id)); }
internal int SaveOffice(tbl_OfficeInfo atbl_OfficeInfo) { _context.tbl_OfficeInfo.Add(atbl_OfficeInfo); _context.SaveChanges(); return(1); }
internal int SaveOffice(tbl_OfficeInfo atbl_OfficeInfo) { return(aOfficeSetup_DAL.SaveOffice(atbl_OfficeInfo)); }