public IActionResult ThemBoPhan(ThemBoPhan boPhan) { var createResult = false; var httpWebRequest = (HttpWebRequest)WebRequest.Create($"{Common.Common.ApiUrl}/nhansu/thembophan"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { var json = JsonConvert.SerializeObject(boPhan); streamWriter.Write(json); } var response = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(response.GetResponseStream())) { var result = streamReader.ReadToEnd(); createResult = bool.Parse(result); } if (createResult) { TempData["Success"] = " created successfully"; } else { TempData["Error"] = " create fail , please try again !"; } return(View(new ThemBoPhan())); }
private void btnThem_Click_1(object sender, EventArgs e) { BoPhanDTO BoPhanDTO = new BoPhanDTO() { ConQuanLy = true }; ThemBoPhan frm = new ThemBoPhan(true, BoPhanDTO); frm.ShowDialog(); hienThi(); }
public bool ThemBoPhan(ThemBoPhan boPhan) { try { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@Ten", boPhan.Ten); SqlMapper.Execute(con, "sp_TaoMoiBoPhan", parameters, commandType: System.Data.CommandType.StoredProcedure); return(true); } catch (Exception exp) { throw exp; } }
private void btnSua_Click(object sender, EventArgs e) { _currentRowIndex = gridView1.FocusedRowHandle; if (_currentRowIndex < 0) { return; } BoPhanDTO BoPhanDTO = new BoPhanDTO() { MaBP = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["MaBP"]).ToString(), TenBP = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["TenBP"]).ToString(), ghichu = gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["GhiChu"]).ToString(), ConQuanLy = bool.Parse(gridView1.GetRowCellValue(_currentRowIndex, gridView1.Columns["ConQuanLy"]).ToString()), }; ThemBoPhan frm = new ThemBoPhan(false, BoPhanDTO); frm.ShowDialog(); hienThi(); }
public bool ThemBoPhan(ThemBoPhan boPhan) { return(_nhanSuService.ThemBoPhan(boPhan)); }
public bool ThemBoPhan(ThemBoPhan boPhan) { return(_nhanSuRepo.ThemBoPhan(boPhan)); }