Esempio n. 1
0
        public async Task <IActionResult> PutSecretIdentity([FromRoute] int id, [FromBody] SecretIdentity secretIdentity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != secretIdentity.id)
            {
                return(BadRequest());
            }

            _context.Entry(secretIdentity).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SecretIdentityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutHero(int id, Hero hero)
        {
            if (id != hero.HeroId)
            {
                return(BadRequest());
            }

            _context.Entry(hero).State = EntityState.Modified;

            try
            {
                Debug.WriteLine(hero.Name);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HeroExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutTodoItem(long id, Hero todoItem)
        {
            if (id != todoItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(todoItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HeroExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutMainAttribute(int id, Mainattribute mainAttribute)
        {
            if (id != mainAttribute.MainattributeId)
            {
                return(BadRequest());
            }

            _context.Entry(mainAttribute).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MainAttributeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 5
0
        public async Task <IActionResult> PutBattleHero([FromRoute] int id, [FromBody] BattleHero battleHero)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != battleHero.battleId)
            {
                return(BadRequest());
            }

            _context.Entry(battleHero).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BattleHeroExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 6
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,health,level,attackPower,currentExp")] Hero hero)
        {
            if (ModelState.IsValid)
            {
                db.Entry(hero).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(hero));
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(long id, Hero hero)
        {
            if (id != hero.Id)
            {
                return(BadRequest());
            }

            _context.Entry(hero).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Esempio n. 8
0
        public async Task <IActionResult> PutHero(long id, Hero item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <Object> putHero(int id, Heros hero)
        {
            if (id != hero.HeroID)
            {
                return(BadRequest());
            }

            HeroContext.Entry(hero).State = EntityState.Modified;

            try
            {
                await HeroContext.SaveChangesAsync();
            }
            catch
            {
            }
            return(Ok());
        }
Esempio n. 10
0
 public virtual void Update(T obj)
 {
     _context.Entry(obj).State = EntityState.Modified;
 }
Esempio n. 11
0
 public void Update(Hero item)
 {
     heroContext.Set <Hero>().Attach(item);
     heroContext.Entry(item).State = EntityState.Modified;
     heroContext.SaveChanges();
 }
 protected override async Task Handle(HeroCommands.HeroUpdateCommand request, CancellationToken cancellationToken)
 {
     heroDbContext.Entry(request.Hero).State = EntityState.Modified;
     await heroDbContext.SaveChangesAsync();
 }
 public virtual void SoftDelete(TEntity entityToDelete)
 {
     entityToDelete.Status = DatabaseEntityStatusEnum.Deleted;
     dbSet.Attach(entityToDelete);
     _context.Entry(entityToDelete).State = EntityState.Modified;
 }
 public void Update <T>(T entity) where T : class
 {
     _heroContext.Update(entity);
     _heroContext.Entry <T>(entity).State = EntityState.Modified;
 }