Answers
- We can use the
AddTransient
method. - We can use the
NotFound
method. - We can use the
BadRequest
method. - The problem is thatÂ
buildingDescription
 in the request doesn't match the name of theÂDescription
 property in the model. If the request is changed to have aÂdescription
 field, then this will resolve the problem. - We can add
Required
attributes toCode
andName
as follows:public class BuildingPostRequest { Â Â Â Â [Required] Â Â Â Â public string Code { get; set; } Â Â Â Â [Required] Â Â Â Â public string Name { get; set; } Â Â Â Â public string Description { get; set; } }
- We can use a
Range
attribute as follows:[Range(1, 10)]
- The
HttpPatch
attribute can be used to handle HTTPPATCH
requests.