public IActionResult Create(CreateFeatureViewModel model) { if (ModelState.IsValid) { var context = new ApplicationContext(); var feature = new Feature { Name = model.Name, ControllerName = model.ControllerName, Description = model.Description }; context.Features.Add(feature); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult CreateFeatures(CreateFeatureViewModel createFeatureViewModel) { try { var model = mapper.Map <Feature>(createFeatureViewModel); featureUnitOfWorkRepository.featureRepository.Add(model); featureUnitOfWorkRepository.Save(); actionFeedback.SuccessUnsuccess = true; return(RedirectToAction("Index", "WritingCenter")); } catch (InvalidOperationException ex) { logger.LogError(ex.Message); } catch (Exception ex) { logger.LogError("General Exception Thrown" + ex.Message); } actionFeedback.SuccessUnsuccess = false; return(View()); }
public ActionResult Create(CreateFeatureViewModel model) { try { string FileName = UploadFile(model.File) ?? string.Empty; if (ModelState.IsValid) { Features feature = new Features { Title = model.Title, Description = model.Description, Image = FileName }; repository.Add(feature); return(RedirectToAction("index")); } return(View(model)); } catch { return(View()); } }
public async Task <CommandResult <Guid> > CreateFeature([FromBody] CreateFeatureViewModel viewModel) { var createfeatureModel = _mapper.Map <FeatureModel>(viewModel); return(await _featureManager.CreateFeature(createfeatureModel)); }
public IActionResult GetBackground(string content, CreateFeatureViewModel viewModel) { viewModel.Scenario.HasBackground = true; viewModel.Scenario.Background = "Background:" + Environment.NewLine + content; return(RedirectToAction("Index", viewModel)); }
// Feature Component Actions public IActionResult GetHeader(string content, CreateFeatureViewModel viewModel) { viewModel.Scenario.Header = "Scenario: " + content; return(RedirectToAction("Index", viewModel)); }
public IActionResult Index(CreateFeatureViewModel viewModel) => View(viewModel);
public IActionResult CheckForXAndYInElement(string element, string x, string y, CreateFeatureViewModel viewModel) { var step = new Step(); step = _queryableService.CheckForXAndYInElement(element, x, y); viewModel.Scenario.StepList.Add(step); return(RedirectToAction("Index", viewModel)); }