public IActionResult AddCargoType() { var model = new SettingInputModel { Action = nameof(this.AddCargoType) }; return(this.View("AddSetting", model)); }
public IActionResult AddLoadingBody() { var model = new SettingInputModel { Action = nameof(this.AddLoadingBody) }; return(this.View("AddSetting", model)); }
public async Task <IActionResult> AddCargoType(SettingInputModel input) { if (!this.ModelState.IsValid) { return(this.Json(new { isValid = false, html = this.View(input) })); } await this.settingsService.AddCargoTypeAsync(input); return(this.Json(new { isValid = true, redirectToUrl = this.Url.Action("CargoTypes", "Settings") })); }
public async Task AddLoadingBodyAsync(SettingInputModel input) { var body = new VehicleLoadingBody { Name = input.Name, }; await this.loadBodies.AddAsync(body); await this.loadBodies.SaveChangesAsync(); }
public async Task AddCargoTypeAsync(SettingInputModel input) { var type = new CargoType { Name = input.Name, }; await this.cargoTypes.AddAsync(type); await this.cargoTypes.SaveChangesAsync(); }
public async Task AddPersonRoleAsync(SettingInputModel input) { var role = new PersonRole { Name = input.Name, }; await this.perRoles.AddAsync(role); await this.perRoles.SaveChangesAsync(); }
public async void AddLoadingBodyTest() { using var dbContext = this.GetDbContext(); var service = this.GetSettingsService(dbContext); var body = new SettingInputModel { Name = "test" }; await service.AddLoadingBodyAsync(body); Assert.True(dbContext.VehicleLoadingBodies.Any(r => r.Name == body.Name)); Assert.Equal(2, dbContext.VehicleLoadingBodies.Count()); }
public async void AddCargoTypeTest() { using var dbContext = this.GetDbContext(); var role = new SettingInputModel { Name = "test1" }; var service = this.GetSettingsService(dbContext); await service.AddCargoTypeAsync(role); Assert.True(dbContext.CargoTypes.Any(r => r.Name == role.Name)); Assert.Equal(2, dbContext.CargoTypes.Count()); }
public async Task <ResultModel <SettingOutputModel> > UpdateSetting([FromBody] SettingInputModel item) { var settingItem = new SettingModel() { Id = item.Id, Name = item.Name, IntValue = item.IntValue, StringValue = item.StringValue, TimeValue = item.TimeValue, SettingValueId = item.SettingValueId, DoubleValue = item.DoubleValue, SettingDataTypeId = item.SettingDataTypeId }; return(await _settingStoreService.UpdateAndSaveAsync <SettingOutputModel>(settingItem)); }