示例#1
0
        public void CreateDebugData()
        {
            using (SystemLogic sl = new SystemLogic())
            {
                sl.CreateUser("Snidd", "*****@*****.**", "magnus", "Magnus Kjellberg");
                sl.CreateUser("Mats", "*****@*****.**", "mats", "Mats Törnros");
                sl.CreateUser("Rikard", "*****@*****.**", "rikard", "Rikard Stenlund");

                var dl = GetDraftLogic.DefaultDraftLogic();

                var member1 = sl.FindMember("Snidd");
                var member2 = sl.FindMember("Mats");
                var member3 = sl.FindMember("Rikard");

                var draft = dl.CreateDraft("Min draft", member1.Id, 75, true);

                dl.AddMemberToDraft(draft.Id, member1.Id, 1);
                dl.AddMemberToDraft(draft.Id, member2.Id, 2);
                dl.AddMemberToDraft(draft.Id, member3.Id, 3);

                dl.StartDraft(draft.Id, false);
            }
        }
示例#2
0
        public ActionResult AddMember(string memberIdentification, int id)
        {
            using (var sl = new SystemLogic())
            {
                var authMember = GetAuthorizedMember();
                var draft      = sl.GetDraftById(id);

                if (draft.Owner.Id != authMember.Id)
                {
                    return(RedirectToAction("Index"));
                }

                var dl = GetDraftLogic.FromDraft(draft);

                var member = sl.FindMember(memberIdentification);
                if (member != null)
                {
                    dl.AddMemberToDraft(draft.Id, member.Id);
                }

                return(RedirectToAction("Start", new { id = draft.Id }));
            }
        }