public new IActionResult Post([FromBody] LicensePlate LicensePlate) { if (!CurrentUser.Id.Equals(LicensePlate.PersonId)) { return(StatusCode(StatusCodes.Status403Forbidden)); } LicensePlate = _plateService.HandlePost(LicensePlate); return(base.Post(LicensePlate)); }
public new IHttpActionResult Post(LicensePlate LicensePlate) { if (!CurrentUser.Id.Equals(LicensePlate.PersonId)) { return(StatusCode(HttpStatusCode.Forbidden)); } LicensePlate = _plateService.HandlePost(LicensePlate); return(base.Post(LicensePlate)); }
public void NoExistingPlates_PostedPlate_ShouldBeMadePrimary() { _repoMock = NSubstitute.Substitute.For <IGenericRepository <LicensePlate> >(); _repoMock.AsQueryable().ReturnsForAnyArgs(new List <LicensePlate>() { }.AsQueryable()); uut = new LicensePlateService(_repoMock); var plate = new LicensePlate() { PersonId = 1 }; uut.HandlePost(plate); Assert.AreEqual(true, plate.IsPrimary); }