Exemplo n.º 1
0
        public async Task <IHttpActionResult> PutM_PlayerInfoMaster(int id, M_PlayerInfoMaster m_PlayerInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != m_PlayerInfoMaster.PlayerID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            M_PlayerInfoMaster m_PlayerInfoMaster = await db.M_PlayerInfoMaster.FindAsync(id);

            db.M_PlayerInfoMaster.Remove(m_PlayerInfoMaster);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetM_PlayerInfoMaster(int id)
        {
            M_PlayerInfoMaster m_PlayerInfoMaster = await db.M_PlayerInfoMaster.FindAsync(id);

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

            return(Ok(m_PlayerInfoMaster));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> PostM_PlayerInfoMaster(M_PlayerInfoMaster m_PlayerInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.M_PlayerInfoMaster.Add(m_PlayerInfoMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = m_PlayerInfoMaster.PlayerID }, m_PlayerInfoMaster));
        }
        // GET: M_PlayerInfoMaster/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_PlayerInfoMaster m_PlayerInfoMaster = await db.M_PlayerInfoMaster.FindAsync(id);

            if (m_PlayerInfoMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(m_PlayerInfoMaster));
        }
Exemplo n.º 6
0
        public async Task <IHttpActionResult> DeleteM_PlayerInfoMaster(int id)
        {
            M_PlayerInfoMaster m_PlayerInfoMaster = await db.M_PlayerInfoMaster.FindAsync(id);

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

            db.M_PlayerInfoMaster.Remove(m_PlayerInfoMaster);
            await db.SaveChangesAsync();

            return(Ok(m_PlayerInfoMaster));
        }
        // GET: M_PlayerInfoMaster/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_PlayerInfoMaster m_PlayerInfoMaster = await db.M_PlayerInfoMaster.FindAsync(id);

            if (m_PlayerInfoMaster == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TeamID       = new SelectList(db.M_TeamInfoMaster, "TeamID", "TeamName", m_PlayerInfoMaster.TeamID);
            ViewBag.PlayerTypeID = new SelectList(db.M_PlayerTypeMaster, "PlayerTypeID", "PlayerType", m_PlayerInfoMaster.PlayerTypeID);
            return(View(m_PlayerInfoMaster));
        }
        public async Task <ActionResult> Create([Bind(Include = "PlayerID,TeamID,PlayerName,PlayerTypeID,PlayerSpecialization,Description,PlayerImage")] M_PlayerInfoMaster m_PlayerInfoMaster)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request.Files["PlayerImage"].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["PlayerImage"].FileName;
                        string FolderPathForImage   = Request.Files["PlayerImage"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName;

                        Request.Files["PlayerImage"].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_PlayerInfoMaster.PlayerImage = base64String;
                                CommonFunction.IsFolderExist(FullPathWithFileName);
                            }
                        }
                    }
                }
                m_PlayerInfoMaster.CreatedBy    = "System";
                m_PlayerInfoMaster.CreatedDate  = DateTime.Now;
                m_PlayerInfoMaster.ModifiedBy   = "System";
                m_PlayerInfoMaster.ModifiedDate = DateTime.Now;
                m_PlayerInfoMaster.Active       = true;

                db.M_PlayerInfoMaster.Add(m_PlayerInfoMaster);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.TeamID       = new SelectList(db.M_TeamInfoMaster, "TeamID", "TeamName", m_PlayerInfoMaster.TeamID);
            ViewBag.PlayerTypeID = new SelectList(db.M_PlayerTypeMaster, "PlayerTypeID", "PlayerType", m_PlayerInfoMaster.PlayerTypeID);
            return(View(m_PlayerInfoMaster));
        }