Что такое веб-API ASP.NET?C#

Место общения программистов C#
Ответить
Гость
 Что такое веб-API ASP.NET?

Сообщение Гость »


I saw a wrong explanation in an explanation video, but it was explained correctly in the video.
This is the code:

Код: Выделить всё

public User Put([FromBody] User user)
{
var editedUser = _users.FirstOrDefault(x => x.Id == user.Id)
editedUser.Firstname = user.Firstname;
editedUser.Lastname = user.Lastname;

return to user;
}
This was an API video. First, he defined fake data as using the bogus library. He created the model class , so there is nothing wrong with the model. But then he wrote the put method as above and the data was updated. Isn't this code wrong?


Источник: https://stackoverflow.com/questions/781 ... eb-api-put
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»