public void UpdateFloor(FloorDto floorDto, long adminId)
        {
            ValidateFloor(floorDto, adminId);
            var floor = _floorService.Find(floorDto.FloorId);

            floor.FloorName = floorDto.FloorName;
            _floorService.Update(floor);
            SaveChanges();
        }
Exemple #2
0
 //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());
        }
Exemple #4
0
        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));
        }
Exemple #5
0
 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')"));
     }
 }
Exemple #6
0
        // 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());
        }