Ejemplo n.º 1
0
        public async Task <IActionResult> Put([FromBody] UserSmsLocation smsLoc)
        {
            try
            {
                string userName = _authService.GetUserNameFromToken(this.HttpContext);

                //todo: get by id and username to verify security
                return(new JsonResult(await _dao.InsertUserSmsLocation(smsLoc)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task DeleteUserAddress()
        {
            UserSmsLocation emailLoc = new UserSmsLocation()
            {
                UserSmsLocationID = 1,
                UserID            = 1,
                UserAddressID     = 1,
                PhoneNumber       = 91655555555
            };
            //Arrange
            var controller = new UserSmsLocationController(_dao, _authService);

            //Act failure
            var result = await controller.Delete(emailLoc);

            //Assert failure
            var failureResult = Assert.IsType <JsonResult>(result);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Delete([FromBody] UserSmsLocation smsLoc)
        {
            try
            {
                string userName = _authService.GetUserNameFromToken(this.HttpContext);

                //todo: get by id and username to verify security
                if (await _dao.DeleteUserSmsLocation(smsLoc))
                {
                    return(new JsonResult("Successfully deleted address."));
                }
                else
                {
                    return(BadRequest("Error deleting address"));
                }
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 4
0
 public Task <bool> DeleteUserSmsLocation(UserSmsLocation smsLoc)
 {
     return(Task.FromResult(true));
 }
Ejemplo n.º 5
0
 public Task <UserSmsLocation> InsertUserSmsLocation(UserSmsLocation smsLoc)
 {
     smsLoc.UserSmsLocationID = 1;
     return(Task.FromResult(smsLoc));
 }
Ejemplo n.º 6
0
 public Task <UserSmsLocation> UpdateUserSmsLocation(UserSmsLocation smsLoc)
 {
     return(Task.FromResult(smsLoc));
 }