コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
 public Task <bool> DeleteUserPushLocation(UserPushLocation pushLoc)
 {
     return(Task.FromResult(true));
 }
コード例 #5
0
 public Task <UserPushLocation> InsertUserPushLocation(UserPushLocation pushLoc)
 {
     pushLoc.UserPushLocationID = 1;
     return(Task.FromResult(pushLoc));
 }
コード例 #6
0
 public Task <UserPushLocation> UpdateUserPushLocation(UserPushLocation pushLoc)
 {
     return(Task.FromResult(pushLoc));
 }