Exemplo n.º 1
0
        public void Add(PartInGroupsModel viewModel)
        {
            var lst = new ParticipantInGroups
            {
                IsDeleted     = false,
                IsEnabled     = true,
                GroupID       = viewModel.GroupID,
                participant   = _participant.Find(viewModel.ParticipantID),
                ParticipantID = viewModel.ParticipantID
            };

            _partInGroups.Add(lst);
        }
Exemplo n.º 2
0
        public virtual async Task <ActionResult> PartList(PartInGroupsModel viewModel, int sportTypeID, Guid?GroupID)
        {
            var test = _Group.GetDetail(GroupID.Value);

            ViewBag.ParticipantList = ParticipantList(sportTypeID, viewModel.ParticipantID, test.CountryID);
            if (ModelState.IsValid)
            {
                if (!_partInGroup.IsExist(viewModel.ParticipantID, viewModel.GroupID))
                {
                    var grp = new PartInGroupsModel
                    {
                        GroupID       = viewModel.GroupID,
                        ParticipantID = viewModel.ParticipantID
                    };
                    _partInGroup.Add(grp);
                    await _uow.SaveChangesAsync();

                    ViewBag.Status = true;
                    try
                    {
                        var model = _partInGroup.GetItemList(GroupID.Value);
                        var g     = _Group.GetDetail(GroupID.Value);
                        ViewBag.TourTitle       = g.TournamentTitle;
                        ViewBag.GroupTitle      = g.Title;
                        ViewBag.TournamID       = g.TournamentID;
                        ViewBag.ParticipantList = ParticipantList(g.SportTypeID, test.ParticipantTypeID, test.CountryID);
                        ViewBag.SportTypeID     = g.SportTypeID;
                        return(View(model));
                    }
                    catch
                    {
                        return(RedirectToAction("Index", "Tournament"));
                    }
                }
                else
                {
                    ViewBag.Message = "عنوان وارد شده تکراری است.";
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }