コード例 #1
0
        public bool DeleteClient(DeleteClientViewModel deleteClient)
        {
            //throw new NotImplementedException();
            Client client = new Client
            {
                Id = deleteClient.Id
            };

            this.context.Clients.Remove(client);
            this.context.SaveChanges();
            return(true);
        }
コード例 #2
0
        public IActionResult Delete(DeleteClientViewModel deleteClient)
        {
            bool result = clientServices.DeleteClient(deleteClient);

            if (!result)
            {
                return(View(deleteClient));
            }
            else
            {
                return(Redirect("/Client/All/"));
            }
        }
コード例 #3
0
        public IActionResult  DeleteConfirmation(int id)
        {
            if (id < 0)
            {
                return(NotFound());
            }
            var _client = _clientRepo.GetById(id);

            if (_client == null)
            {
                return(NotFound());
            }
            DeleteClientViewModel client = _mapper.Map <DeleteClientViewModel>(_client);

            return(PartialView("_DeleteConfirmation", client));
        }
コード例 #4
0
        public IActionResult  Delete(DeleteClientViewModel _client)
        {
            try
            {
                if (_client.Id < 0)
                {
                    return(NotFound());
                }
                var client = _clientRepo.GetById(_client.Id);
                if (client == null)
                {
                    return(NotFound());
                }

                _clientRepo.Delete(client);
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(RedirectToAction(nameof(Index)));
            }
        }
コード例 #5
0
 private void Delete_Clicked(object sender, RoutedEventArgs e)
 {
     DataContext = new DeleteClientViewModel();
 }