Beispiel #1
0
        public ActionResult Index(ClientViewModel clientViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    bool isDuplicate = false;
                    clientViewModel.ClientName = clientViewModel.ClientName.Trim();
                    isDuplicate = clientViewModel.CheckDuplicate(clientViewModel);

                    if (isDuplicate)
                    {
                        clientViewModel.GetClientDetails();
                        ViewBag.Message = "Client Already Exists";
                        clientViewModel.GetScreenAccessRights("Client Details");
                        return(View("Index", clientViewModel));
                    }
                    else
                    {
                        clientViewModel.AddClient(clientViewModel);
                        clientViewModel.GetClientDetails();
                        ViewBag.Message = "New Client Added Successfully";
                        clientViewModel.GetScreenAccessRights("Client Details");
                        return(View("Index", clientViewModel));
                    }
                }
                clientViewModel.GetClientDetails();
                clientViewModel.GetScreenAccessRights("Client Details");
                return(View(clientViewModel));
            }
            catch (Exception ex)
            {
                errorlogviewmodel = new ErrorLogViewModel();
                errorlogviewmodel.LogError(ex);
                return(View("Error"));
            }
        }
Beispiel #2
0
 private void addClientToDatabaseButton_Click(object sender, RoutedEventArgs e)
 {
     viewModel.AddClient();
 }