/// <summary> /// Restore rent from database /// </summary> /// <param name="storedRent"></param> /// <returns></returns> private RentModel RestoreRent(StoredRent storedRent) { var rent = JsonConvert.DeserializeObject <RentModel>(storedRent.Rent); rent.Confirm = ConfirmActionResult; rent.StoredId = storedRent.Id; rent.Test = InputBox; rent.Navigate = Navigate; rent.RecalculateTime(storedRent.Date); return(rent); }
private async Task <int> StoreRent() { return(await Task.Run(() => { var stored = new StoredRent(); stored.Rent = JsonConvert.SerializeObject(_rent); stored.Date = DateTime.Now; stored.Type = _rent.RentPrice.Vehicle; return App.Database.StoreRent(stored); })); }
public int StoreRent(StoredRent item) { lock (locker) { if (item.Id != 0) { database.Update(item); return(item.Id); } else { return(database.Insert(item)); } } }