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)); } }
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); }
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)); } }
public Task <bool> DeleteUserSmsLocation(UserSmsLocation smsLoc) { return(Task.FromResult(true)); }
public Task <UserSmsLocation> InsertUserSmsLocation(UserSmsLocation smsLoc) { smsLoc.UserSmsLocationID = 1; return(Task.FromResult(smsLoc)); }
public Task <UserSmsLocation> UpdateUserSmsLocation(UserSmsLocation smsLoc) { return(Task.FromResult(smsLoc)); }