This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="col-sm-2"> | |
| <button class="btn btn-default" (click)="deleteUser(user)">Delete</button> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Injectable() | |
| export class UserService { | |
| constructor(private http: Http) { | |
| } | |
| deleteUser(user:User): Observable<any>{ | |
| return this.http.post("http://localhost:3000/deleteUser", { id: user._id }) | |
| .map((res:any) => { | |
| return res.json(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.post('/deleteUser', function(req, res, next) { | |
| User.remove({_id : req.body.id}, function(err) { | |
| if (err) { | |
| console.log("not removed!"); | |
| res.status(400); | |
| res.send(); | |
| } | |
| console.log("removed!"); | |
| res.send({status: 'ok'}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String s = null; | |
| Console.Write(s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String? s = null; | |
| Console.Write(s); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int x = 1; | |
| int y = 1; | |
| retrun x == y; //retruns true | |
| var x = new SomeType(); | |
| var y = new SomeType(); | |
| return x == y, //returns false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Student(string Name, decimal Gpa); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Student : IEquatable<Student> | |
| { | |
| public string Name { get; } | |
| public decimal Gpa { get; } | |
| public Student(string Name, decimal Gpa) | |
| { | |
| this.Name = Name; | |
| this.Gpa = Gpa; | |
| } | |
| public bool Equals(Student other) // for IEquatable<Student> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IAsyncEnumerable<Data> someData = | |
| searchEngine.Get(query); | |
| foreach await (var data in someData) { // ... } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| await Task.Run(() => disposableEntity.Dispose()); |