public async Task <IActionResult> Edit(string id, [Bind("UserName")] TbUserPhoto tbUserPhoto, IFormFile Fotografi)
 {
     if (id != tbUserPhoto.UserName)
     {
         return(NotFound());
     }
     //.......................................................
     byte[] imageData = null;
     if (Fotografi != null)
     {
         using (var binary = new BinaryReader(Fotografi.OpenReadStream()))
         {
             imageData = binary.ReadBytes((Int32)Fotografi.Length);
         }
     }
     //.......................................................
     if (ModelState.IsValid)
     {
         try
         {
             //.......................................................
             tbUserPhoto.UserPhoto = imageData;
             //.......................................................
             _context.Update(tbUserPhoto);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!TbUserPhotoExists(tbUserPhoto.UserName))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(tbUserPhoto));
 }
        public async Task <IActionResult> Create([Bind("UserName")] TbUserPhoto tbUserPhoto, IFormFile Fotografi)
        {
            if (ModelState.IsValid)
            {
                //.......................................................
                byte[] imageData = null;
                if (Fotografi != null)
                {
                    using (var binary = new BinaryReader(Fotografi.OpenReadStream()))
                    {
                        imageData = binary.ReadBytes((Int32)Fotografi.Length);
                    }
                }
                //.......................................................
                tbUserPhoto.UserPhoto = imageData;
                //.......................................................
                _context.Add(tbUserPhoto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbUserPhoto));
        }