sonal malhotra

sonal malhotra

  • NA
  • 410
  • 52.4k

two topics in angular 2(not jjs) .

Jun 27 2019 4:14 AM
hi experts,
 
1) https://embed.plnkr.co/plunk/7ubJ3l .. that link is not showing for full code
 
so i m asking expert
 
here is code employyee sservice.ts.
 
DeleteEmployee(id) {
return this._http.delete(
'http://localhost:52467/Employee/Delete/' + id
);
}
ShowEmployee(id): Observable<Employee> {
return this._http
.get('http://localhost:52467/Employee/GetEmployee/' + id)
.map((response: Response) => <Employee>response.json());
}
 
as Above i cant found link like this
,http://localhost:52467/Employee/Delete/,get('http://localhost:52467/Employee/GetEmployee/
 
from where i got these link n what is code in these code ?
 
is this for vss code?? or is this for visual studio ? any idea for what to do for process of service/mvc?
2) i found another link http://www.advancesharp.com/blog/1215/angular-2-crud-with-web-api-2
 
here is code webapi method
  1. [HttpPost]  
  2. [Route("api/Customer/SaveCustomer")]  
  3. public IHttpActionResult SaveCustomer(Customer customer)  
  4. {  
  5. if (customer.Id > 0)  
  6. {  
  7. var dbCustomer = db.Customers.FirstOrDefault(x=>x.Id == customer.Id);  
  8. dbCustomer.Name = customer.Name;  
  9. dbCustomer.Address = customer.Address;  
  10. dbCustomer.Phone = customer.Phone;  
  11. db.SaveChanges();  
  12. }  
  13. else  
  14. {  
  15. db.Customers.Add(customer);  
  16. db.SaveChanges();  
  17. }  
  18. return Ok(customer.Id);  
  19. }  
is this webapi for visual studio ?
that link is saying it is for vs code only .. is it true? or can i use both vscode or vs ?
i cant do anything without www.c-sharpcorner.com. so i need help for step to step demo source code

Answers (4)