//Floor button - Add floor, Edit floor and Save (Depending on settings page state) // Consider this button as "save button" for now private void FloorButtonCommand() { if (SettingsModes.Editing == _currentMode) { if (false == CheckIfNameIsValid()) { return; } UpdateFloorFromUI(_floor); _floorService.Update(_floor); _currentMode = SettingsModes.Preview; } else if (SettingsModes.CreatingNew == _currentMode) { if (false == CheckIfNameIsValid()) { return; } UpdateFloorFromUI(_floor); _floorService.Add(_floor); _currentMode = SettingsModes.Preview; } else { _currentMode = SettingsModes.CreatingNew; _floor = _floorService.CreateEmptyFloor(DefaultFloorName); LoadFloor(_floor); } }
public IActionResult Create([Bind("FloorID,Ref,Name,Sequence")] Floor floor) { if (ModelState.IsValid) { service.Add(floor); return(RedirectToAction(nameof(Index))); } return(View(floor)); }
public JavaScriptResult Create(FloorViewModel rackvm) { try { _floorService.Add(Mapper.Map <Floor>(rackvm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/Floor"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
// POST: api/Floors public void Post([FromBody] FloorDTO floorDTO) { Floor floor = GetFloorFromDTO(floorDTO); Service.Add(floor); }