Enable update and create food

This commit is contained in:
2024-08-09 18:37:51 +02:00
parent 265c51edae
commit f105595195
5 changed files with 296 additions and 0 deletions

16
app.go
View File

@@ -26,4 +26,20 @@ func (a *App) GetFood() WailsFood {
return WailsFood{Success: false, Error: err.Error()}
}
return WailsFood{Data: data, Success: true}
}
func (a *App) CreateFood(food Food) WailsFood1 {
data, err := foodService.Create(food)
if err != nil {
return WailsFood1{Success: false, Error: err.Error()}
}
return WailsFood1{Data: data, Success: true}
}
func (a *App) UpdateFood(food Food) WailsFood1 {
data, err := foodService.Update(food)
if err != nil {
return WailsFood1{Success: false, Error: err.Error()}
}
return WailsFood1{Data: data, Success: true}
}