예제 #1
0
        public ActionResult RemovePick(int id, string cardName)
        {
            var member = GetAuthorizedMember();

            using (var sl = new SystemLogic())
            {
                if (!sl.IsMemberOfDraft(member.Id, id))
                {
                    return(RedirectToAction("Index"));
                }

                List <FuturePick> futurePicks = sl.GetMyFuturePicks(id, member.Id);

                foreach (var futurePick in futurePicks)
                {
                    var card = sl.GetCard(futurePick.Card.Id);
                    if (card.Name.Equals(cardName))
                    {
                        sl.RemoveMyFuturePick(futurePick.Id);
                        return(Json(new { dvm = GetDraftViewModel(id), success = true }, JsonRequestBehavior.AllowGet));
                    }
                }

                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
        }