コード例 #1
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);
     }
 }
コード例 #2
0
 public IActionResult Create([Bind("FloorID,Ref,Name,Sequence")] Floor floor)
 {
     if (ModelState.IsValid)
     {
         service.Add(floor);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(floor));
 }
コード例 #3
0
ファイル: FloorController.cs プロジェクト: basharnaim/ERP
 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')"));
     }
 }
コード例 #4
0
        // POST: api/Floors
        public void Post([FromBody] FloorDTO floorDTO)
        {
            Floor floor = GetFloorFromDTO(floorDTO);

            Service.Add(floor);
        }