public IActionResult Create(Guid spaceId) { CacheHelper.SetPreviousPage(_cache, Request.Headers["Referer"].ToString()); PropertyKeyViewModel model = new PropertyKeyViewModel(_cache); if (spaceId != Guid.Empty) { model.SelectedPropertyKey = new PropertyKey() { SpaceId = spaceId }; } return(View(model)); }
public async Task <ActionResult> Create(PropertyKeyViewModel model, string updateButton) { if (updateButton.Equals("Cancel")) { return(Redirect(CacheHelper.GetPreviousPage(_cache))); } try { var id = await DigitalTwinsHelper.CreatePropertyKeyAsync(model.SelectedPropertyKey, _cache, Loggers.SilentLogger); await FeedbackHelper.Channel.SendMessageAsync($"PropertyKey with id '{id}' successfully created.", MessageType.Info); return(Redirect(CacheHelper.GetPreviousPage(_cache))); } catch (Exception ex) { await FeedbackHelper.Channel.SendMessageAsync(ex.Message, MessageType.Info); return(View()); } }