示例#1
0
        // GET: api/MatchInfoMaters
        public IHttpActionResult GetM_MatchInfoMaters()
        {
            IList <C_MatchInfoModel> ObjMatchList = new List <C_MatchInfoModel>();
            M_TeamInfoMaster         ObjTeam1     = new M_TeamInfoMaster();
            M_TeamInfoMaster         ObjTeam2     = new M_TeamInfoMaster();
            var Result = db.M_MatchInfoMaters.OrderByDescending(x => x.MatchID);

            foreach (var s in Result)
            {
                ObjMatchList.Add(
                    new C_MatchInfoModel()
                {
                    MatchID           = s.MatchID,
                    MatchDate         = s.MatchDate,
                    Team1             = s.Team1,
                    Team1Code         = s.M_TeamInfoMaster.TeamCode,
                    Team1Logo         = s.M_TeamInfoMaster.TeamLogo,
                    Team1Name         = s.M_TeamInfoMaster.TeamName,
                    Team2             = s.Team2,
                    Team2Code         = s.M_TeamInfoMaster1.TeamCode,
                    Team2Logo         = s.M_TeamInfoMaster1.TeamLogo,
                    Team2Name         = s.M_TeamInfoMaster1.TeamName,
                    MatchLocation     = s.MatchLocation,
                    MatchBanner       = s.MatchBanner,
                    LiveWatchingCount = s.LiveWatchingCount,
                    TotalOverMatch    = s.TotalOverMatch
                }
                    );
            }
            return(Ok(ObjMatchList));
        }
        public async Task <IHttpActionResult> PutM_TeamInfoMaster(int id, M_TeamInfoMaster m_TeamInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != m_TeamInfoMaster.TeamID)
            {
                return(BadRequest());
            }

            db.Entry(m_TeamInfoMaster).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!M_TeamInfoMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            M_TeamInfoMaster m_TeamInfoMaster = await db.M_TeamInfoMaster.FindAsync(id);

            db.M_TeamInfoMaster.Remove(m_TeamInfoMaster);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <IHttpActionResult> GetM_TeamInfoMaster(int id)
        {
            M_TeamInfoMaster m_TeamInfoMaster = await db.M_TeamInfoMaster.FindAsync(id);

            if (m_TeamInfoMaster == null)
            {
                return(NotFound());
            }

            return(Ok(m_TeamInfoMaster));
        }
示例#5
0
        public async Task <ActionResult> Edit([Bind(Include = "TeamID,TeamType,TeamCode,TeamName,TeamLocation,Country,TeamLogo,Description,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,Active")] M_TeamInfoMaster m_TeamInfoMaster)
        {
            if (ModelState.IsValid)
            {
                db.Entry(m_TeamInfoMaster).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(m_TeamInfoMaster));
        }
        public async Task <IHttpActionResult> PostM_TeamInfoMaster(M_TeamInfoMaster m_TeamInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.M_TeamInfoMaster.Add(m_TeamInfoMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = m_TeamInfoMaster.TeamID }, m_TeamInfoMaster));
        }
        public async Task <IHttpActionResult> DeleteM_TeamInfoMaster(int id)
        {
            M_TeamInfoMaster m_TeamInfoMaster = await db.M_TeamInfoMaster.FindAsync(id);

            if (m_TeamInfoMaster == null)
            {
                return(NotFound());
            }

            db.M_TeamInfoMaster.Remove(m_TeamInfoMaster);
            await db.SaveChangesAsync();

            return(Ok(m_TeamInfoMaster));
        }
示例#8
0
        // GET: M_TeamInfoMaster/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_TeamInfoMaster m_TeamInfoMaster = await db.M_TeamInfoMaster.FindAsync(id);

            if (m_TeamInfoMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(m_TeamInfoMaster));
        }
示例#9
0
        public async Task <ActionResult> Create([Bind(Include = "TeamID,TeamType,TeamCode,TeamName,TeamLocation,Country,TeamLogo,Description")] M_TeamInfoMaster m_TeamInfoMaster)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request.Files["TeamLogo"].FileName))
                {
                    string FolderPath = Server.MapPath(Resources.P11Resources.UploadedImages);// + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek;
                    if (CommonFunction.IsFolderExist(FolderPath))
                    {
                        string FullPathWithFileName = FolderPath + "\\" + Request.Files["TeamLogo"].FileName;
                        string FolderPathForImage   = Request.Files["TeamLogo"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName;

                        Request.Files["TeamLogo"].SaveAs(FullPathWithFileName);
                        using (Image image = Image.FromFile(FullPathWithFileName))
                        {
                            using (MemoryStream m = new MemoryStream())
                            {
                                image.Save(m, image.RawFormat);
                                byte[] imageBytes   = m.ToArray();
                                string base64String = Convert.ToBase64String(imageBytes);
                                m_TeamInfoMaster.TeamLogo = base64String;
                                CommonFunction.IsFolderExist(FullPathWithFileName);
                            }
                        }
                    }

                    //string FolderPath = Server.MapPath(Resources.D2cResource.TextNewImagesPath);// + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek;
                    //string FullPathWithFileName = FolderPath + "\\" + Request.Files["StdProfilePicPath"].FileName;
                    //string FolderPathForImage = Request.Files["StdProfilePicPath"].FileName;  //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName;
                    //if (CommonFunction.IsFolderExist(FolderPath))
                    //{
                    //    Request.Files["StdProfilePicPath"].SaveAs(FullPathWithFileName);
                    //    StudentImagePath = FolderPathForImage;
                    //}
                }
                m_TeamInfoMaster.CreatedBy    = "System";
                m_TeamInfoMaster.CreatedDate  = DateTime.Now;
                m_TeamInfoMaster.ModifiedBy   = "System";
                m_TeamInfoMaster.ModifiedDate = DateTime.Now;
                m_TeamInfoMaster.Active       = true;
                db.M_TeamInfoMaster.Add(m_TeamInfoMaster);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(m_TeamInfoMaster));
        }