Пример #1
0
        public IActionResult TaoPhongBan(TaoPhongBan model)
        {
            int ketQua = 0;
            var url    = $"{Common.Common.ApiUrl}/phongban/taophongban";

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);

            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "POST";
            using (var streamWrite = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                var json = JsonConvert.SerializeObject(model);
                streamWrite.Write(json);
            }
            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            {
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    var resKetQua = streamReader.ReadToEnd();
                    ketQua = int.Parse(resKetQua);
                }
                if (ketQua > 0)
                {
                    TempData["ThanhCong"] = "TeamData-đã tạo thành công";
                }
                ModelState.Clear();
                return(View(new TaoPhongBan()
                {
                }));
            }
        }
Пример #2
0
 public int TaoPhongBan(TaoPhongBan request)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@MaPhongBan ", request.MaPhongBan);
         parameters.Add("@TenPhongBan", request.TenPhongBan);
         var id = SqlMapper.ExecuteScalar <int>(con, "TaoPhongBan", param: parameters, commandType: CommandType.StoredProcedure);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 public bool CreatePhongBan(TaoPhongBan phongban)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@MaPB", phongban.MaPB);
         parameters.Add("@TenPB", phongban.TenPB);
         SqlMapper.Execute(con, "CreatePhongBan", param: parameters, commandType: CommandType.StoredProcedure);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
0
 public int TaoPhongBan([FromBody] TaoPhongBan request)
 {
     return(_phongBanService.TaoPhongBan(request));
 }
Пример #5
0
 public int TaoPhongBan(TaoPhongBan request)
 {
     return(_phongBanRepository.TaoPhongBan(request));
 }
Пример #6
0
 public bool CreatePhongBan(TaoPhongBan phongban)
 {
     return(_PhongBanRepository.CreatePhongBan(phongban));
 }
Пример #7
0
 public bool Create([FromBody] TaoPhongBan phongBan)
 {
     return(_PhongBanService.CreatePhongBan(phongBan));
 }