public void SaveTransaction(HeaderVm header, DateTime date, Guid customerId) { if (!DoesTransactionExist(header.Id)) { var transaction = _mapper.Map <Transaction>(header); transaction.CustomerId = customerId; transaction.Date = date; _dbContext.Transactions.Add(transaction); _dbContext.SaveChanges(); } }
private async void LoadHeaderVm() { try { HeaderVm = MenuService.LoadHeaderVmIfExist(); await HeaderVm?.Initialize(); } catch (UnauthorizedAccessException ex) { MvxTrace.Trace(MvvmCross.Platform.Platform.MvxTraceLevel.Error, "MenuViewModel: ", ex.Message); } catch (FileNotFoundException ex) { MvxTrace.Trace(MvvmCross.Platform.Platform.MvxTraceLevel.Error, "MenuViewModel: ", ex.Message); } catch { MvxTrace.Trace(MvvmCross.Platform.Platform.MvxTraceLevel.Error, "MenuViewModel: ", "Can't load header vm"); } }