public void AddTexture(TextureModel texture) { if (ModelVerification(texture)) { genericRepo.Insert(texture); } }
public void CheckOut(ApplicationUser user) { IEnumerable <Order> orders = _orderRepo.GetOrdersForUser(user.Id); List <Order> newOrders = new List <Order>(); orders.Select(order => { if (order.OrderLine == null) { newOrders.Add(order); _orderLineRepo.SetEntityState(order, EntityState.Unchanged); } return(order); }); OrderLine line = new OrderLine() { User = user, Orders = newOrders, Date = DateTime.Now, Delivered = false }; _orderLineRepo.SetEntityState(user, EntityState.Unchanged); _orderLineRepo.Insert(line); _orderLineRepo.SaveChanges(); //add to queue //string json = JsonConvert.SerializeObject(line); }
private async void SaveUser() { if (string.IsNullOrEmpty(NewUser.firstName)) { await PageDialogService.DisplayAlertAsync("", "First Name cannot be empty", "Ok"); return; } if (string.IsNullOrEmpty(NewUser.lastName)) { await PageDialogService.DisplayAlertAsync("", "Last Name cannot be empty", "Ok"); return; } if (string.IsNullOrEmpty(NewUser.phoneNumber)) { await PageDialogService.DisplayAlertAsync("", "Phone Number cannot be empty", "Ok"); return; } if (string.IsNullOrEmpty(NewUser.email)) { await PageDialogService.DisplayAlertAsync("", "Email ID cannot be empty", "Ok"); return; } if (string.IsNullOrEmpty(NewUser.address)) { await PageDialogService.DisplayAlertAsync("", "Address cannot be empty", "Ok"); return; } if (NewUser.age == 0) { await PageDialogService.DisplayAlertAsync("", "Please enter age", "Ok"); return; } var a = await PageDialogService.DisplayAlertAsync("Save", "Do you want to save it?", "Yes", "No"); if (a) { if (NewUser.IsSynced) { SendToServerTOUpdate(NewUser); } else { _studentRepo.Insert(NewUser); await PageDialogService.DisplayAlertAsync("", "Saved successfully", "OK"); } } }
public TextureRepo(LiteDBContext c, IGenericRepo <TextureModel> repository) { genericRepo = repository; context = c; textures = context.litedb.GetCollection <TextureModel>("textures"); if (textures.Count() == 0) { context.LoadDefaultTextureDirectoryIntoDatabase(Textures); } for (int i = 1; i <= textures.Count(); i++) { var t = textures.FindById(i); genericRepo.Insert(t); } }
public void Insert(Device device, IEnumerable <int> selectedFrameworks, IEnumerable <int> selectedOSs) { DoAction(device, selectedFrameworks, selectedOSs, d => _deviceRepo.Insert(d)); }