public IActionResult Create([Bind("EntryId,PlatformId,Description")] EntryPlatformListViewModel vwModel) { if (ModelState.IsValid) { var dbModel = _mapper.Map <EntryPlatformModel>(vwModel); _entryPlatformRepository.Insert(dbModel); ViewData["message"] = "PLatform entry added successfully."; ModelState.SetModelValue("Description", new ValueProviderResult("")); ModelState.SetModelValue("PlatformId", new ValueProviderResult("")); var vwModel2 = new EntryPlatformListViewModel() { EntryId = vwModel.EntryId }; SetSelectList(); return(View(vwModel2)); } return(View(vwModel)); }
private static void Process(int column, string value, EntryModel dbModel, ExcelWorksheet ws) { var entryId = 0; var entry = _entryRepository .SelectList() .Where(x => x.CategoryId.Equals(dbModel.CategoryId)) .Where(x => x.SubCategoryId.Equals(dbModel.SubCategoryId)) .Where(x => x.LexiconFunction.Equals(dbModel.LexiconFunction)) .Where(x => x.Recommendation.Equals(dbModel.Recommendation)) .Where(x => x.Notes.Equals(dbModel.Notes)) .FirstOrDefault(); if (entry != null) { entryId = entry.Id; } if (entryId.Equals(0)) { entryId = _entryRepository.Insert(dbModel); } var platFormName = ws.Cells[_appSettings.PlatformLine, column].Value.ToString(); var playFormId = _platformRepository .SelectList() .Where(x => x.Description.Equals(platFormName)) .FirstOrDefault() .Id; var entryPlatform = new EntryPlatformModel() { Description = value, EntryId = entryId, PlatformId = playFormId }; _entryPlatformRepository.Insert(entryPlatform); }
public JsonResult Post([FromBody] EntryPlatformModel value) { return(new JsonResult(EntryPlatformRepository.Insert(value))); }