コード例 #1
0
 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));
 }
コード例 #2
0
        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());
        }
コード例 #3
0
        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());
            }
        }
コード例 #4
0
ファイル: Feature.cs プロジェクト: shakermegahed/CoreCrud
        public async Task <CommandResult <Guid> > CreateFeature([FromBody] CreateFeatureViewModel viewModel)
        {
            var createfeatureModel = _mapper.Map <FeatureModel>(viewModel);

            return(await _featureManager.CreateFeature(createfeatureModel));
        }
コード例 #5
0
 public IActionResult GetBackground(string content, CreateFeatureViewModel viewModel)
 {
     viewModel.Scenario.HasBackground = true;
     viewModel.Scenario.Background    = "Background:" + Environment.NewLine + content;
     return(RedirectToAction("Index", viewModel));
 }
コード例 #6
0
 // Feature Component Actions
 public IActionResult GetHeader(string content, CreateFeatureViewModel viewModel)
 {
     viewModel.Scenario.Header = "Scenario: " + content;
     return(RedirectToAction("Index", viewModel));
 }
コード例 #7
0
 public IActionResult Index(CreateFeatureViewModel viewModel) => View(viewModel);
コード例 #8
0
        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));
        }