public async Task <IActionResult> PutAppUserOnObject(int id, PublicApi.v1.DTO.AppUserOnObject appUserOnObject) { if (id != appUserOnObject.Id) { return(BadRequest()); } // if (!await _bll.AppUsersOnObjects.BelongsToUserAsync(id, User.GetUserId())) // { // return NotFound(); // } _bll.AppUsersOnObjects.Update(PublicApi.v1.Mappers.AppUserOnObjectMapper.MapFromExternal(appUserOnObject)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <PublicApi.v1.DTO.AppUserOnObject> > PostAppUserOnObject( PublicApi.v1.DTO.AppUserOnObject appUserOnObject) { // if (!await _bll.AppUsers.BelongsToUserAsync(appUserOnObject.AppUserId, User.GetUserId())) // { // return NotFound(); // } appUserOnObject = PublicApi.v1.Mappers.AppUserOnObjectMapper.MapFromInternal( _bll.AppUsersOnObjects.Add(PublicApi.v1.Mappers.AppUserOnObjectMapper.MapFromExternal(appUserOnObject))); await _bll.SaveChangesAsync(); appUserOnObject = PublicApi.v1.Mappers.AppUserOnObjectMapper.MapFromInternal( _bll.AppUsersOnObjects.GetUpdatesAfterUOWSaveChanges( PublicApi.v1.Mappers.AppUserOnObjectMapper.MapFromExternal(appUserOnObject))); return(CreatedAtAction("GetAppUserOnObject", new { version = HttpContext.GetRequestedApiVersion().ToString(), id = appUserOnObject.Id }, appUserOnObject)); }