public async Task <IActionResult> Edit(int id, [Bind("UserId,UserName,PassWord,Type,Email,Photo,IsActive,RolGroups,Id")] TbUsers tbUsers)
        {
            if (id != tbUsers.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tbUsers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TbUsersExists(tbUsers.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbUsers));
        }
        public async Task <IActionResult> Create([Bind("UserId,UserName,PassWord,Type,Email,Photo,IsActive,RolGroups,Id")] TbUsers tbUsers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tbUsers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbUsers));
        }
        public BLLResult Insert(string fromuser, string touser, string text, string html, string senderIP, bool IsSent)
        {
            BLLResult res   = new BLLResult();
            TbUsers   FUser = Api.FindUser(fromuser);
            TbUsers   TUser = Api.FindUser(touser);

            if (FUser != null && TUser != null)
            {
                if (!string.IsNullOrEmpty(text))
                {
                    TbMessage msg = new TbMessage();
                    msg.MessageId         = NetTalk.GuidTools.Create();
                    msg.MessageDate       = DateTime.Now;
                    msg.MessageFromUserId = FUser.UserId;
                    msg.MessageHTML       = html;
                    msg.MessageSenderIP   = senderIP;
                    msg.MessageText       = text;
                    msg.MessageToUserId   = TUser.UserId;
                    msg.TbUsers           = TUser;
                    msg.TbUsers1          = FUser;
                    if (IsSent)
                    {
                        msg.MessageViewDate = DateTime.Now;
                    }

                    Api.Insert(msg);
                    res.IsSuccess    = (Api.Save() > 0);
                    res.ErrorMessage = Api.SaveError;
                }
                else
                {
                    res.ErrorMessage = "user not found";
                }
            }
            return(res);
        }
 public Task UpdateAsync(TbUsers entity)
 {
     throw new NotImplementedException();
 }
 public Task <TbUsers> AddAsync(TbUsers entity)
 {
     throw new NotImplementedException();
 }