Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
6
Reply
Update and Delete operation
Anjali Kumari
Mar 6 2017 5:43 AM
245
Reply
I wan to perform some Put and Delete opeartions using angular2 I tried the
syed shanu example for the Get operation similarly I want to perform some CRUD operations like Post,Put and Delete operations..Please provide the example using angular2
http://www.c-sharpcorner.com/article/create-our-first-asp-net-core-angular-2-starter-application-net-core-using-te/#ReadAndPostComment
the below method I used for Put operation...
[HttpPut("{id}")]
public async Task<IActionResult> Updateuser([FromRoute] int id, [FromBody] User users)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != users.Id)
{
return BadRequest();
}
_context.Entry(users).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (Exception ex)
{
ex.Message.ToString();
}
return NoContent();
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
how to calculate result based on formula using angular
Multiple ways of calling data from server to UI in angular2