Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Hero hero = Db.Hero.Find(id);

            Db.Hero.Remove(hero);
            Db.SaveChanges();
            RedisContext.Remove($"hero-gamesave-{id}");
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public HttpResponseMessage DeleteCharacter(int heroId)
        {
            Hero    hero    = Db.Hero.Find(heroId);
            Profile profile = Db.Profile.FirstOrDefault(u => u.UserName == User.Identity.Name);

            if (hero == null || hero.ProfileID != profile.ID)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
            Db.Hero.Remove(hero);
            if (0 == Db.SaveChanges())
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }

            RedisContext.Remove($"hero-gamesave-{heroId}");
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="redisContext"></param>
 /// <param name="mobile"></param>
 private void RemoveByRedis(RedisContext redisContext, string mobile)
 {
     redisContext.Remove(REDIS_Key, mobile + DAY_Key);
 }