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; } }
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 }
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; } }
public bool Create(ThanhvienModel model) { return(_res.Create(model)); }
public ThanhvienModel Login(ThanhvienModel thanhvien) { var kq = _res.Login(thanhvien); return(kq); }
public bool Update(ThanhvienModel model) { return(_res.Update(model)); }
public ThanhvienModel UpdateKH([FromBody] ThanhvienModel model) { abc.Update(model); return(model); }
public ThanhvienModel Login([FromBody] ThanhvienModel model) { var kq = abc.Login(model); return(kq); }