public ActionResult EditMoreDetail(AllDataDTO obj, IList <IFormFile> files, int id)
        {
            if (ModelState.IsValid)
            {
                //var filepath = Path.GetTempFileName();

                //foreach (IFormFile item in files)
                //{
                //    string filename = ContentDispositionHeaderValue.Parse(item.ContentDisposition).FileName.Trim('"');
                //    filename = this.EnsureFilename(filename);

                //    using (FileStream filestream = System.IO.File.Create(this.Getpath(filename, id)))
                //    {
                //        obj.ImageUrl = filename;
                //    }

                //}

                try
                {
                    _shopData.EditedDetail(obj);
                    return(RedirectToAction("Index", "Shop", new { id = id }));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(View());
        }
Ejemplo n.º 2
0
        private void LoadStakeholders(IList <MatchPreviewAthleteDTO> athleteDtos, IntiDataContext db)
        {
            var userFavorites = from utf in db.Ext_UserFavoriteTeam
                                where utf.UserGUID == SessionProps.UserGuid
                                select utf;

            //for each of these players, get a reference to the teams that has selected them
            var teams = new Dictionary <Guid, MatchPreviewTeamDTO>(10);

            foreach (var athlete in athleteDtos)
            {
                var teamVersions = (from ta in db.Inti_TeamAthlete
                                    join u in userFavorites
                                    on ta.Inti_TeamVersion.Inti_Team equals u.Inti_Team into oj
                                    from utf in oj.DefaultIfEmpty()
                                    where
                                    (ta.Inti_TeamVersion.Inti_Team.IsPaid ?? false) &&
                                    (ta.Inti_TeamVersion.Inti_Team.IsActive ?? false) &&
                                    ta.Inti_TeamVersion.ValidFrom <= DateTime.Today &&
                                    (ta.Inti_TeamVersion.ValidTo ?? DateTime.Today) >= DateTime.Today &&
                                    ta.AthleteGUID == athlete.AthleteClubGuid
                                    select new MatchPreviewTeamDTO()
                {
                    TeamGuid = ta.Inti_TeamVersion.TeamGUID,
                    TeamName = ta.Inti_TeamVersion.Inti_Team.Name,
                    Manager =
                        String.Format("{0} {1}", ta.Inti_TeamVersion.Inti_Team.Sys_User.FirstName,
                                      ta.Inti_TeamVersion.Inti_Team.Sys_User.LastName).Trim(),
                    CustomClass = (SessionProps.UserGuid == utf.UserGUID) ? "active" : "list-group-item-info"
                }).ToList();


                foreach (var matchPreviewTeamDTO in teamVersions.Where(matchPreviewTeamDTO => !teams.ContainsKey(matchPreviewTeamDTO.TeamGuid)))
                {
                    teams.Add(matchPreviewTeamDTO.TeamGuid, matchPreviewTeamDTO);
                }

                foreach (var matchPreviewTeamDTO in teamVersions)
                {
                    teams[matchPreviewTeamDTO.TeamGuid].Athletes.Add(new AthleteSubDTO()
                    {
                        AthleteClubGuid = athlete.AthleteClubGuid, Name = athlete.Name
                    });
                }
            }


            var allData = new AllDataDTO();

            allData.Athletes = athleteDtos.ToArray();
            allData.Teams    = teams.Values.OrderByDescending(t => t.Athletes.Count).ToArray();

            //set PreviewData to the Json object for jsRender to work with
            PreviewData = JsonConvert.SerializeObject(allData);
        }
Ejemplo n.º 3
0
        public AllDataDTO ShowAllDetail(int id)
        {
            SignUp     SData   = _db.SignUps.Where(x => x.SignUpId == id).FirstOrDefault();
            MoreDetail Mdata   = _db.MoreDetails.Where(x => x.SignUpId == id).FirstOrDefault();
            AllDataDTO AllData = new AllDataDTO();

            AllData.FullName            = SData.FullName;
            AllData.Address             = SData.Address;
            AllData.Email               = SData.Email;
            AllData.PhoneNumber         = SData.PhoneNumber;
            AllData.LoginType           = SData.LoginType;
            AllData.AdditionAddress     = Mdata.AdditionAddress;
            AllData.AdditionPhoneNumber = Mdata.AdditionPhoneNumber;
            AllData.Location            = Mdata.Location;
            AllData.ImageUrl            = Mdata.ImageUrl;
            AllData.MoreDetailId        = Mdata.MoreDetailId;
            AllData.SignUpId            = Mdata.SignUpId;
            return(AllData);
        }
Ejemplo n.º 4
0
        public void EditedDetail(AllDataDTO obj)  //how to save data into 2 table from one view
        {
            SignUp     SData = _db.SignUps.Where(x => x.SignUpId == obj.SignUpId).FirstOrDefault();
            MoreDetail Mdata = _db.MoreDetails.Where(x => x.SignUpId == obj.SignUpId).FirstOrDefault();


            SData.FullName            = obj.FullName;
            SData.Address             = obj.Address;
            SData.Email               = obj.Email;
            SData.PhoneNumber         = obj.PhoneNumber;
            SData.LoginType           = obj.LoginType;
            Mdata.AdditionAddress     = obj.AdditionAddress;
            Mdata.AdditionPhoneNumber = obj.AdditionPhoneNumber;
            Mdata.Location            = obj.Location;
            Mdata.ImageUrl            = obj.ImageUrl;

            _db.SignUps.Update(SData);
            _db.MoreDetails.Update(Mdata); //.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _db.SaveChanges();
        }
Ejemplo n.º 5
0
        private void LoadStakeholders(IList<MatchPreviewAthleteDTO> athleteDtos, IntiDataContext db)
        {
            var userFavorites = from utf in db.Ext_UserFavoriteTeam
                                where utf.UserGUID == SessionProps.UserGuid
                                select utf;

            //for each of these players, get a reference to the teams that has selected them
            var teams = new Dictionary<Guid, MatchPreviewTeamDTO>(10);
            foreach (var athlete in athleteDtos)
            {
                var teamVersions = (from ta in db.Inti_TeamAthlete
                                    join u in userFavorites
                                    on ta.Inti_TeamVersion.Inti_Team equals u.Inti_Team into oj
                                    from utf in oj.DefaultIfEmpty()
                                    where
                                        (ta.Inti_TeamVersion.Inti_Team.IsPaid ?? false) &&
                                        (ta.Inti_TeamVersion.Inti_Team.IsActive ?? false)
                                        && ta.Inti_TeamVersion.ValidFrom <= DateTime.Today &&
                                        (ta.Inti_TeamVersion.ValidTo ?? DateTime.Today) >= DateTime.Today
                                        && ta.AthleteGUID == athlete.AthleteClubGuid
                                    select new MatchPreviewTeamDTO()
                                    {
                                        TeamGuid = ta.Inti_TeamVersion.TeamGUID,
                                        TeamName = ta.Inti_TeamVersion.Inti_Team.Name,
                                        Manager =
                                            String.Format("{0} {1}", ta.Inti_TeamVersion.Inti_Team.Sys_User.FirstName,
                                                ta.Inti_TeamVersion.Inti_Team.Sys_User.LastName).Trim(),
                                        CustomClass = (SessionProps.UserGuid == utf.UserGUID) ? "active" : "list-group-item-info"
                                    }).ToList();

                foreach (var matchPreviewTeamDTO in teamVersions.Where(matchPreviewTeamDTO => !teams.ContainsKey(matchPreviewTeamDTO.TeamGuid)))
                {
                    teams.Add(matchPreviewTeamDTO.TeamGuid, matchPreviewTeamDTO);
                }

                foreach (var matchPreviewTeamDTO in teamVersions)
                {
                    teams[matchPreviewTeamDTO.TeamGuid].Athletes.Add(new AthleteSubDTO() { AthleteClubGuid = athlete.AthleteClubGuid, Name = athlete.Name });
                }
            }

            var allData = new AllDataDTO();
            allData.Athletes = athleteDtos.ToArray();
            allData.Teams = teams.Values.OrderByDescending(t => t.Athletes.Count).ToArray();

            //set PreviewData to the Json object for jsRender to work with
            PreviewData = JsonConvert.SerializeObject(allData);
        }