public async Task <IActionResult> Save(AliasListModel.AliasItem model) { try { await _service.Save(model); var result = await _service.GetList(model.SiteId); result.Status = new StatusMessage { Type = StatusMessage.Success, Body = _localizer.Alias["The alias was successfully added to the list"] }; return(Ok(result)); } catch (ValidationException e) { var result = new AliasListModel(); result.Status = new StatusMessage { Type = StatusMessage.Error, Body = e.Message }; return(BadRequest(result)); } }
public async Task <IActionResult> Save(AliasListModel.ListItem model) { try { await _service.Save(model); var result = await _service.GetList(); result.Status = new StatusMessage { Type = StatusMessage.Success, Body = $"The alias <code>{ model.AliasUrl }</code> was added to the list" }; return(Ok(result)); } catch (ValidationException e) { var result = new AliasListModel(); result.Status = new StatusMessage { Type = StatusMessage.Error, Body = e.Message }; return(BadRequest(result)); } }