public CommonExample UpdateAsync(CommonExample updatedExample)
        {
            var entity = _context.CommonExamples.Attach(updatedExample);

            entity.State = EntityState.Modified;
            return(updatedExample);
        }
        public async Task <CommonExample> CreateAsync(CommonExample newExample)
        {
            var rasaNluDataId = _context.RasaNLUDatas.FirstOrDefault();

            newExample.RasaNLUData = rasaNluDataId;
            await _context.AddAsync(newExample);

            return(newExample);
        }
示例#3
0
        public async Task <Entity> CreateAsync(Entity newExample, CommonExample entityId)
        {
            var commonExample = await _context.CommonExamples.FindAsync(entityId);

            newExample.CommonExample = commonExample;
            await _context.Entities.AddAsync(newExample);

            return(newExample);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CommonExample = await _repository.GetExampleByIdAsync(id);

            if (CommonExample == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CommonExample = await _repository.GetExampleByIdAsync(id);

            if (CommonExample != null)
            {
                await _repository.DeleteAsync(CommonExample.Id);

                await _repository.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }