Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //DbContext.Attach(ReactionMap).State = EntityState.Modified;

            var entity = DbContext.ReactionMaps.Find(ReactionMap.Id);

            await TryUpdateModelAsync(entity, nameof(ReactionMap));


            try
            {
                await DbContext.SaveChangesAsync();

                SiteContext.ClearReactionMap();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReactionMapExists(ReactionMap.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            DbContext.ReactionMaps.Add(ReactionMap);
            await DbContext.SaveChangesAsync();

            SiteContext.ClearReactionMap();

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