public async Task <ActionResult <InfoUsers> > GetFriend() { InfoUsers user = await db.Info_Users.FirstOrDefaultAsync(x => x.Login.ToUpper() == User.Identity.Name.ToUpper()); if (user == null) { return(NotFound()); } return(new ObjectResult(user)); }
[HttpGet] //("{login}") public async Task <ActionResult <InfoUsers> > Get(string login) { InfoUsers user = await db.Info_Users.FirstOrDefaultAsync(x => x.Login.ToUpper() == login.ToUpper()); if (user == null) { return(NotFound()); } return(new ObjectResult(user)); }
public async Task <ActionResult <InfoUsers> > Post(InfoUsers user) { if (user == null) { return(BadRequest()); } db.Info_Users.Add(user); await db.SaveChangesAsync(); return(Ok(user)); }
public async Task <ActionResult <InfoUsers> > Delete(string Login) { InfoUsers user = db.Info_Users.FirstOrDefault(x => x.Login == Login); if (user == null) { return(NotFound()); } db.Info_Users.Remove(user); await db.SaveChangesAsync(); return(Ok(user)); }
public async Task <ActionResult <InfoUsers> > Put(InfoUsers user) { if (user == null) { return(BadRequest()); } if (!db.Info_Users.Any(x => x.Login == user.Login)) { return(NotFound()); } db.Update(user); await db.SaveChangesAsync(); return(Ok(user)); }