public async Task <IActionResult> Edit(Guid id, [Bind("Id,SenderUser,ReceiverUser,Subject,Text,Readed")] TblMesage tblMesage) { if (id != tblMesage.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tblMesage); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblMesageExists(tblMesage.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tblMesage)); }
public async Task <IActionResult> Create([Bind("Id,SenderUser,ReceiverUser,Subject,Text,Readed")] TblMesage tblMesage) { if (ModelState.IsValid) { tblMesage.Id = Guid.NewGuid(); tblMesage.SenderUser = User.Identity.Name.ToUpper(); tblMesage.Readed = false; tblMesage.ReceiverUser = tblMesage.ReceiverUser.ToUpper(); _context.Add(tblMesage); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tblMesage)); }