public async Task <int> CreateFunds(Data.funds funds) { _sqLiteConnection = await DependencyService.Get <ISQLite>().GetConnection(); //var db = new ISQLite().Connition; int res = _sqLiteConnection.Insert(funds); var x = 0; return(res); }
public async Task <int> DleateFunds(Data.funds funds) { _sqLiteConnection = await DependencyService.Get <ISQLite>().GetConnection(); //var db = new ISQLite().Connition; var res = _sqLiteConnection.Delete(funds); if (res != null) { return(res); } else { return(0); } var x = 5; }
public async Task <int> Updatefunds(Data.funds funds) { _sqLiteConnection = await DependencyService.Get <ISQLite>().GetConnection(); var existingfunds = _sqLiteConnection.Query <Data.funds>("select * from funds where funds_id = ?", funds.funds_id).FirstOrDefault(); if (existingfunds != null) { var res = _sqLiteConnection.Update(funds); return(res); } else { var res = 0; return(res); } #region ubdate Comment ------------------------ //var db = new ISQLite().Connition; //var res =_sqLiteConnection.Execute( // "UPDATE costomar " + // "SET name = " + costomar.name + // ",phone1 = " + costomar.phone1 + // ",phone2 = " + costomar.phone2 + // ",phone3 = " + costomar.phone3 + // ",IDnum = " + costomar.IDnum + // ",address = " + costomar.address + // ",BuildingNUM = " + costomar.BuildingNUM + // ",flatNum = " + costomar.flatNum + // ",Email = " + costomar.Email + // ",guarantorName = " + costomar.guarantorName + // ",guarantorphone = " + costomar.guarantorphone + // ",ban = " + costomar.ban + // ",costomarColor = " + costomar.costomarColor + // ",voucherNUM = " + costomar.voucherNUM + // " WHERE employeeid = ? ;" , costomar.costomar_id); //var res = _sqLiteConnection.Query<Data.costomar>( // "UPDATE costomar " + // "SET name = " + costomar.name + // ",phone1 = " + costomar.phone1 + // ",phone2 = " + costomar.phone2 + // ",phone3 = " + costomar.phone3 + // ",IDnum = " + costomar.IDnum + // ",address = " + costomar.address + // ",BuildingNUM = " + costomar.BuildingNUM + // ",flatNum = " + costomar.flatNum + // ",Email = " + costomar.Email + // ",guarantorName = " + costomar.guarantorName + // ",guarantorphone = " + costomar.guarantorphone + // ",ban = " + costomar.ban + // ",costomarColor = " + costomar.costomarColor + // ",voucherNUM = " + costomar.voucherNUM + // " WHERE employeeid = "+ costomar.costomar_id +";"); //var existingcostomar = _sqLiteConnection.Query<Data.costomar>("select * from costomar where costomar_id = ?", costomar.costomar_id).FirstOrDefault(); //if (existingcostomar != null) //{ // existingcostomar.name = costomar.name; // _sqLiteConnection.RunInTransaction(() => // { // _sqLiteConnection.Update(existingcostomar); // }); // var res = 1; // return res; //} //else //{ // var res = 0; // return res; //} #endregion }