I am getting this error zone.js:3243 POST https://localhost:44424/api/SlgCorpNotes/Edit 405 (Method Not Allowed)
Here is my service api call
updateMessage(message: any) {
console.log("at service")
console.log(message)
return this.http.post(this.baseUrl + 'api/SlgCorpNotes/Edit', message)
}
When I console.log message I receive this.
Object
departments: 4
noteBody: "asdf"
weeks: SLGTime {year: 2020, week: 12, quarter: 1, weekEnding: "2020-01-18T00:00:00", lyweekEnding: "2019-01-19T00:00:00"}
__proto__: Object
So I know I am sending information to the .net controller in the back end. Here is my controller method. Is this possibly not set up to receive the angular info correctly?
[HttpPost]
[Route("api/SlgCorpNotes/Edit")]
public void Edit([FromBody]object item)
{
_SLGContext.Entry(item).State = EntityState.Modified;
_SLGContext.SaveChanges();
}
More info that may be useful. Here is the name of my namespace and Route
namespace mocHub2.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SlgCorpNotesController : Controller
This is my formgroup info that i'm sending.
this.optionsForm = new FormGroup({
departments: new FormControl(),
weeks: new FormControl(),
noteBody: new FormControl()
})
I think what it is, is Im not naming something correctly. Sorry this is my first .net/angular project. Usually Im just on razor views and .net mvc!
this.baseUrl + 'api/SlgCorpNotes/Edit'creates a correct URL. It can be seen what url is used to make API call in network tab of your browser