public IActionResult DeleteProperty(int id) { var prop = _configurationDbContext.Set <ApiResourceProperty>() .Include(x => x.ApiResource) .FirstOrDefault(x => x.Id == id); return(View(ApiResourcePropertyModel.FromEntity(prop))); }
public IActionResult DeleteProperty(ApiResourcePropertyModel model) { var api = _configurationDbContext.ApiResources .Include(x => x.Properties) .FirstOrDefault(x => x.Id == model.ApiResource.Id); var prop = api.Properties.FirstOrDefault(x => x.Id == model.Id); api.Properties.Remove(prop); _configurationDbContext.SaveChanges(); return(RedirectToAction(nameof(Properties), new { id = api.Id })); }
public async Task <IActionResult> Create(ApiResourcePropertyModel model) { if (!ModelState.IsValid) { return(RedirectToAction(nameof(Index), new { apiResourceId = model.ApiResourceId })); } var insertedResult = await _apiResourcePropertyService.InsertApiResourceProperty(CommonMappers.Mapper.Map <ApiResourceProperty>(model)); if (insertedResult > 0) { SuccessNotification(await _localizationService.GetResourceAsync("ApiResourceProperty.Added")); } return(RedirectToAction(nameof(Index), new { apiResourceId = model.ApiResourceId })); }
public async Task <IActionResult> Delete(ApiResourcePropertyModel model) { if (model.Id == 0) { return(RedirectToAction(nameof(Index))); } var result = await _apiResourcePropertyService.DeleteApiResourceProperty(CommonMappers.Mapper.Map <ApiResourceProperty>(model)); if (result) { SuccessNotification(await _localizationService.GetResourceAsync("ApiResourceProperty.Deleted")); return(RedirectToAction(nameof(Index), new { apiResourceId = model.ApiResourceId })); } return(View(model)); }