public void TestService() { var _options = new DbContextOptionsBuilder <FunctionContext>().UseInMemoryDatabase("delete_profile").Options; FunctionContext db_context = new FunctionContext(_options); using (FunctionContext db_add_context = new FunctionContext(_options)) { db_add_context.Profiles.Add(new ProfileModel { id = 1, name = "iFew", about_us = "Hello World!", add_datetime = DateTime.Parse("2019-01-16 11:59:59") }); db_add_context.SaveChanges(); } ProfileService service = new ProfileService(db_context); var response = service.DeleteProfile("1"); var response_data = JsonConvert.DeserializeObject <RespondModel>(response.Body); Assert.Equal(200, response.StatusCode); Assert.Equal("true", response_data.result.ToString()); }
public bool DeleteProfile(int?createResult) { var deleteResult = _profileService.DeleteProfile(createResult.Value); ValidateSuccess(deleteResult, nameof(DeleteProfile)); return(deleteResult.IsSuccess); }
public async Task DeleteProfile(Profile profile) { MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the profile ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (result == MessageBoxDialogResult.Yes) { await ProfileService.DeleteProfile(profile.Id); await RefreshListAsync(); } }
public IActionResult DeletebyId(int id) { var data = _profileService.DeleteProfile(id); if (data.exception != null) { return(BadRequest(data.exception.Message)); } else { return(Ok(data.result)); } }
protected async Task DeleteProfile() { MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the profile ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (result == MessageBoxDialogResult.Yes) { await ProfileService.DeleteProfile(OneProfile.Id); StatusClass = "alert-danger"; Message = "Deleted successfully"; StateHasChanged(); await Task.Delay(1000); NavigationManager.NavigateTo("/admin/profiles"); } }
public async Task <IActionResult> DeleteConfirmed(string id) { profileService.DeleteProfile(id); return(RedirectToAction(nameof(Index))); }
/// <summary> /// Deletes the target user. /// </summary> public static void Delete_Target_User() { ProfileService service = new ProfileService(); service.DeleteProfile(Actor.TARGET_USER); }
/// <summary> /// Deletes the authenticated user. /// </summary> public static void Delete_Auth_User() { ProfileService service = new ProfileService(); service.DeleteProfile(Actor.AUTH_USER); }