public IHttpActionResult Order(string nguoinhan, string sdt, string diachi, int?idKH, string listIdSP, string listsoluong) { try { int[] idSP = new DonHangDAO().ConvertStringToArray(listIdSP); int[] soluong = new DonHangDAO().ConvertStringToArray(listsoluong); DONHANG dh = new DONHANG(nguoinhan, sdt, diachi, idKH); int idDH = DH_DAO.InsertDonHang(dh); for (int i = 0; i < idSP.Length; i++) { CHITIETDONHANG CTDH = new CHITIETDONHANG(idSP[i], dh.ID, soluong[i], (int)new SANPHAM_DAO().GetPriceBySanPham(idSP[i]).GIABAN); new ChiTietDH_DAO().InsertCHITIETDH(CTDH); } return(Ok(1)); } catch { return(Ok(0)); } }
public static bool InsertDonHang(DonHangDTO donHangDTO) { return(DonHangDAO.InsertDonHang(donHangDTO)); }