Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        public bool DeleteProfile(int?createResult)
        {
            var deleteResult = _profileService.DeleteProfile(createResult.Value);

            ValidateSuccess(deleteResult, nameof(DeleteProfile));

            return(deleteResult.IsSuccess);
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        public IActionResult DeletebyId(int id)
        {
            var data = _profileService.DeleteProfile(id);

            if (data.exception != null)
            {
                return(BadRequest(data.exception.Message));
            }
            else
            {
                return(Ok(data.result));
            }
        }
Exemplo n.º 5
0
        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");
            }
        }
Exemplo n.º 6
0
 public async Task <IActionResult> DeleteConfirmed(string id)
 {
     profileService.DeleteProfile(id);
     return(RedirectToAction(nameof(Index)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Deletes the target user.
 /// </summary>
 public static void Delete_Target_User()
 {
     ProfileService service = new ProfileService();
     service.DeleteProfile(Actor.TARGET_USER);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Deletes the authenticated user.
 /// </summary>
 public static void Delete_Auth_User()
 {
     ProfileService service = new ProfileService();
     service.DeleteProfile(Actor.AUTH_USER);
 }