public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,Gender,Bio,UserAccountId,DisplayName")] DatingProfile datingProfile,
                                               IFormFile FilePhoto)
        {
            if (id != datingProfile.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(datingProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DatingProfileExists(datingProfile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(datingProfile));
        }
Esempio n. 2
0
        public IActionResult Read(int id)
        {
            MailMessages mail = _context.MailMessages.FirstOrDefault(m => m.Id == id);

            mail.IsRead = true;
            _context.Update(mail);
            _context.SaveChanges();
            return(View(mail));
        }