public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Indx,CourseId,Logo,Link")] CourseSponsor courseSponsor, IFormFile myfile)
        {
            if (id != courseSponsor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                courseSponsor.Logo = await UserFile.UploadeNewImageAsync(courseSponsor.Logo,
                                                                         myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);

                try
                {
                    _context.Update(courseSponsor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseSponsorExists(courseSponsor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Courses, "Id", "ArName", courseSponsor.CourseId);
            return(View(courseSponsor));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Indx,CourseId,Logo,Link")] CourseSponsor courseSponsor, IFormFile myfile)
        {
            if (ModelState.IsValid)
            {
                courseSponsor.Logo = await UserFile.UploadeNewImageAsync(courseSponsor.Logo,
                                                                         myfile, _environment.WebRootPath, Properties.Resources.ScientificEvent, 500, 500);


                _context.Add(courseSponsor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Courses, "Id", "ArName", courseSponsor.CourseId);
            return(View(courseSponsor));
        }