public async Task <IActionResult> Put([FromBody] UserPushLocation pushLoc) { try { string userName = _authService.GetUserNameFromToken(this.HttpContext); //todo: get by id and username to verify security return(new JsonResult(await _dao.InsertUserPushLocation(pushLoc))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task DeleteUserAddress() { UserPushLocation emailLoc = new UserPushLocation() { UserPushLocationID = 1, UserID = 1, UserAddressID = 1, PhoneNumber = 91655555555 }; //Arrange var controller = new UserPushLocationController(_dao, _authService); //Act failure var result = await controller.Delete(emailLoc); //Assert failure var failureResult = Assert.IsType <JsonResult>(result); }
public async Task <IActionResult> Delete([FromBody] UserPushLocation pushLoc) { try { string userName = _authService.GetUserNameFromToken(this.HttpContext); //todo: get by id and username to verify security if (await _dao.DeleteUserPushLocation(pushLoc)) { return(new JsonResult("Successfully deleted address.")); } else { return(BadRequest("Error deleting address")); } } catch (Exception e) { return(BadRequest(e.Message)); } }
public Task <bool> DeleteUserPushLocation(UserPushLocation pushLoc) { return(Task.FromResult(true)); }
public Task <UserPushLocation> InsertUserPushLocation(UserPushLocation pushLoc) { pushLoc.UserPushLocationID = 1; return(Task.FromResult(pushLoc)); }
public Task <UserPushLocation> UpdateUserPushLocation(UserPushLocation pushLoc) { return(Task.FromResult(pushLoc)); }