- Timestamp:
- 01/06/23 02:51:45 (23 months ago)
- Branches:
- main
- Children:
- d4b888e
- Parents:
- 1bd8d1e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/AdminController.java
r1bd8d1e rf484b14 1 1 package com.example.autopartz.controller; 2 2 3 import com.example.autopartz.model.Deliveryman; 3 4 import com.example.autopartz.model.Role; 4 5 import com.example.autopartz.model.User; 5 6 import com.example.autopartz.model.Warehouseman; 7 import com.example.autopartz.repository.DeliverymanRepository; 6 8 import com.example.autopartz.repository.WarehousemanRepository; 7 9 import com.example.autopartz.service.UserService; … … 13 15 import org.springframework.web.bind.annotation.RequestMapping; 14 16 15 import javax.annotation.security.RolesAllowed;16 17 import javax.servlet.http.HttpServletResponse; 17 18 import java.io.IOException; … … 25 26 private final UserService userService; 26 27 private final WarehousemanRepository warehousemanRepository; 28 private final DeliverymanRepository deliverymanRepository; 27 29 28 public AdminController(UserService userService, WarehousemanRepository warehousemanRepository ) {30 public AdminController(UserService userService, WarehousemanRepository warehousemanRepository, DeliverymanRepository deliverymanRepository) { 29 31 this.userService = userService; 30 32 this.warehousemanRepository = warehousemanRepository; 33 this.deliverymanRepository = deliverymanRepository; 31 34 } 32 35 … … 44 47 wh.setEmployed_from(LocalDate.now()); 45 48 warehousemanRepository.save(wh); 49 50 } 51 else { 52 Deliveryman dm = (Deliveryman) userService.findById(id); 53 dm.setEmployed_from(LocalDate.now()); 54 deliverymanRepository.save(dm); 46 55 try { 47 56 response.sendRedirect("/viewUsers");
Note:
See TracChangeset
for help on using the changeset viewer.