Example #1
0
        public IActionResult TaoNhanVien(TaoNhanVien model)
        {
            int            ketQua         = 0;
            var            url            = $"{Common.Common.ApiUrl}/nhanvien/taonhanvien";
            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"] = "Đã tạo nhân viên thành công";
            }
            ModelState.Clear();
            ViewBag.PhongBans  = DanhSachPhongBan();
            ViewBag.PhongBanId = phongBanId;
            return(View(new TaoNhanVien()
            {
            }));
        }
Example #2
0
 public bool CreateNhanVien(TaoNhanVien TaoNhanVien)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@IDPB", TaoNhanVien.IDPB);
         parameters.Add("@HoTen", TaoNhanVien.HoTen);
         parameters.Add("@SoDienThoai", TaoNhanVien.SoDienTHoai);
         SqlMapper.Execute(con, "CreateNhanVien", param: parameters, commandType: CommandType.StoredProcedure);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 public int TaoNhanVien(TaoNhanVien request)
 {
     try
     {
         DynamicParameters parameters = new DynamicParameters();
         parameters.Add("@Ho", request.Ho);
         parameters.Add("@Ten", request.Ten);
         parameters.Add("@DiaChi", request.DiaChi);
         parameters.Add("@DienThoai", request.DienThoai);
         parameters.Add("@Email", request.Email);
         parameters.Add("@PhongBanId", request.PhongBanId);
         var id = SqlMapper.ExecuteScalar <int>(con, "TaoNhanVien", param: parameters, commandType: CommandType.StoredProcedure);
         return(id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public int TaoNhanVien([FromBody] TaoNhanVien request)
 {
     return(_nhanVienService.TaoNhanVien(request));
 }
Example #5
0
 public int TaoNhanVien(TaoNhanVien request)
 {
     return(_nhanVienResponsitory.TaoNhanVien(request));
 }
Example #6
0
 public bool CreateNhanVien(TaoNhanVien TaoNhanVien)
 {
     return(_NhanVienRepository.CreateNhanVien(TaoNhanVien));
 }
Example #7
0
 public bool CreateNV([FromBody] TaoNhanVien TaoNhanVien)
 {
     return(_NhanVienService.CreateNhanVien(TaoNhanVien));
 }