public async Task UpdateAsync_WhenCalled_InvokesRepositoryUpdateMethod()
        {
            // Arrange
            var busStation = new BusStationModel();

            // Act
            await _busStationService.UpdateAsync(busStation);

            // Assert
            _mockAsyncRepository.Verify(m => m.UpdateAsync(It.IsAny <MasterBusStation>()), Times.Once);
        }
Exemple #2
0
        public async Task <IActionResult> Edit(BusStationEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var editModel = new BusStationModel
            {
                BusStationId   = model.BusStationId,
                RouteId        = model.RouteId,
                BusStationName = model.BusStationName,
                BusStationCode = model.BusStationCode,
                TimeInDay      = model.TimeInDay,
                TimeInNight    = model.TimeInNight
            };

            await _busStationService.UpdateAsync(editModel);

            return(RedirectToAction(nameof(Index)));
        }
Exemple #3
0
        public async Task <BusStationModel> Put(int id, [FromBody] BusStationModel model)
        {
            var result = await _busStationService.UpdateAsync(model);

            return(result);
        }