Last active
November 20, 2020 18:05
-
-
Save krittawatcode/9827c7eebe4b5828bc41abd846b3ec0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controller | |
import ( | |
"strconv" | |
"github.com/gin-gonic/gin" | |
"github.com/krittawatcode/go-soldier-mvc/service" | |
) | |
type SoldierController interface { | |
Eat(c *gin.Context) | |
} | |
type soldierController struct { | |
dutyService service.DutyService | |
} | |
func SoldierHandler(dutyService *service.DutyService) SoldierController { | |
return &soldierController{ | |
dutyService: *dutyService, | |
} | |
} | |
func (s *soldierController) Eat(c *gin.Context) { | |
commission, _ := strconv.Atoi(c.Param("commission")) | |
s.dutyService.EatTax(c, commission) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment