Ejemplo n.º 1
0
        public bool Create(ThanhvienModel model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "themkhachhang",
                                                                              "@TENDANGNHAP", model.TENDANGNHAP,
                                                                              "@MATKHAU", model.MATKHAU,
                                                                              "@HOTEN", model.HOTEN,
                                                                              "@GIOITINH", model.GIOITINH,
                                                                              "@DIACHI", model.DIACHI,
                                                                              "@DIENTHOAI", model.DIENTHOAI,
                                                                              "@EMAIL", model.EMAIL,
                                                                              "@QUYEN", model.QUYEN,
                                                                              "@MAKICHHOAT", model.MAKICHHOAT,
                                                                              "@KICHHOAT", model.KICHHOAT
                                                                              );
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public ThanhvienModel CreateKH([FromBody] ThanhvienModel model)
        {
            if (abc.KiemTraUser(model.TENDANGNHAP, model.DIENTHOAI, model.EMAIL))
            {
                return(null);
            }
            ThanhvienModel result = new ThanhvienModel();

            abc.Create(model);
            result.TENDANGNHAP = model.TENDANGNHAP;
            result.DIACHI      = model.DIACHI;
            result.DIENTHOAI   = model.DIENTHOAI;
            result.EMAIL       = model.EMAIL;
            result.HOTEN       = model.HOTEN;
            result.KICHHOAT    = model.KICHHOAT;
            result.QUYEN       = model.QUYEN;
            result.NGAYDANGKY  = model.NGAYDANGKY;
            result.GIOITINH    = model.GIOITINH;
            return(result); //không nên return model vì sẽ bị lộ mật khaaur
        }
Ejemplo n.º 3
0
        public ThanhvienModel Login(ThanhvienModel thanhvien)
        {
            string msgError = "";

            try
            {
                var dt = _dbHelper.ExecuteSProcedureReturnDataTable(out msgError, "dangnhap",
                                                                    "@tendangnhap", thanhvien.TENDANGNHAP, "@matkhau", thanhvien.MATKHAU,
                                                                    "@dienthoai", thanhvien.DIENTHOAI, "@email", thanhvien.EMAIL
                                                                    );
                if (!string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(msgError);
                }
                return(dt.ConvertTo <ThanhvienModel>().FirstOrDefault());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
 public bool Create(ThanhvienModel model)
 {
     return(_res.Create(model));
 }
Ejemplo n.º 5
0
        public ThanhvienModel Login(ThanhvienModel thanhvien)
        {
            var kq = _res.Login(thanhvien);

            return(kq);
        }
Ejemplo n.º 6
0
 public bool Update(ThanhvienModel model)
 {
     return(_res.Update(model));
 }
Ejemplo n.º 7
0
 public ThanhvienModel UpdateKH([FromBody] ThanhvienModel model)
 {
     abc.Update(model);
     return(model);
 }
Ejemplo n.º 8
0
        public ThanhvienModel Login([FromBody] ThanhvienModel model)
        {
            var kq = abc.Login(model);

            return(kq);
        }