public async Task <ActionResult> Edit(SpaceViewModel model, string updateButton) { if (updateButton.Equals("Cancel")) { return(Redirect(CacheHelper.GetPreviousPage(_cache))); } try { await DigitalTwinsHelper.UpdateSpaceAsync(model.SelectedSpaceItem, _cache, Loggers.SilentLogger); return(Redirect(CacheHelper.GetPreviousPage(_cache))); } catch (Exception ex) { await FeedbackHelper.Channel.SendMessageAsync(ex.Message, MessageType.Info); model = new SpaceViewModel(_cache, model.SelectedSpaceItem.Id); return(View(model)); } }
public async Task <IActionResult> Remove(Guid spaceId, string name) { if (spaceId != Guid.Empty && name != null && name != string.Empty) { Space space = await DigitalTwinsHelper.GetSpaceAsync((Guid)spaceId, _cache, Loggers.SilentLogger); var prop = space.Properties.FirstOrDefault(p => p.Name.Equals(name)); if (prop != null) { space.Properties.Remove(prop); await DigitalTwinsHelper.UpdateSpaceAsync(space, _cache, Loggers.SilentLogger); } return(Redirect(Request.Headers["Referer"].ToString())); } else { //TODO replace with default view (List) return(RedirectToAction(nameof(PropertyKeyController.Create))); } }