public IActionResult DeleteMachin(int id) { var machin = _maBd.Machin.FirstOrDefault(m => m.Id == id); if (machin == null) { return(NotFound()); } _maBd.Remove(machin); _maBd.SaveChanges(); return(new OkResult()); }
public IActionResult DeleteUser(int id) { var identity = _maBd.Utilisateur.FirstOrDefault(u => u.Id == id); if (identity == null) { return(new ObjectResult(null)); } _maBd.Remove(identity); _maBd.SaveChanges(); return(new OkResult()); }
public IActionResult DeleteComment(int commentId) { var comm = _maBd.Comment.FirstOrDefault(m => m.commentId == commentId); if (comm == null) { return(NotFound()); } _maBd.Remove(comm); _maBd.SaveChanges(); return(new OkResult()); }
public IActionResult DeleteProfil(int id) { var profil = _maBd.Profil.FirstOrDefault(pr => pr.profilId == id); if (profil == null) { return(new OkObjectResult(null)); } _maBd.Remove(profil); _maBd.SaveChanges(); return(new OkResult()); }
public IActionResult DeletePostUser(int id) { var post = _maBd.PostsUser.FirstOrDefault(m => m.postId == id); if (post == null) { return(NotFound()); } _maBd.Remove(post); _maBd.SaveChanges(); return(new OkResult()); }
public bool unFollow(string current, string follow) { Following rel = new Following(); rel.FollowedId = int.Parse(follow); rel.FollowerId = int.Parse(current); var res = _maBd.Following.FirstOrDefault(m => m.FollowedId == rel.FollowedId && m.FollowerId == rel.FollowerId); if (res == null) { return(false); } _maBd.Remove(res); _maBd.SaveChanges(); return(true); }