public void UpdateFloor(FloorDto floorDto, long adminId) { ValidateFloor(floorDto, adminId); var floor = _floorService.Find(floorDto.FloorId); floor.FloorName = floorDto.FloorName; _floorService.Update(floor); SaveChanges(); }
//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 async Task <IHttpActionResult> Update([FromBody] FloorTrimViewModel viewmodel) { var model = Mapper.Map <Floor>(viewmodel); await _floorService.Update(model); return(Ok()); }
public IActionResult Edit(long id, [Bind("FloorID,Ref,Name,Sequence")] Floor floor) { if (id != floor.FloorID) { return(NotFound()); } if (ModelState.IsValid) { try { service.Update(floor); } catch (DbUpdateConcurrencyException) { if (!FloorExists(floor.FloorID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(floor)); }
public JavaScriptResult Edit(FloorViewModel rackvm) { try { _floorService.Update(Mapper.Map <Floor>(rackvm)); return(JavaScript($"ShowResult('{"Data updated successfully."}','{"success"}','{"redirect"}','{"/APanel/Floor"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
// PUT: api/Floors public void Put([FromBody] FloorDTO floorDTO) { Floor floor = GetFloorFromDTO(floorDTO); Service.Update(floor); }
public IHttpActionResult Put(FloorDto floorDto) { _service.Update(floorDto); return(Ok()); }