Exemplo n.º 1
0
        public ActionResult Index()
        {
            try
            {
                ClientViewModel clientViewModel = new ClientViewModel();
                //if (id == null)
                //    id = (int)TempData["ClientId"];
                clientViewModel.GetClientDetails();
                clientViewModel.GetScreenAccessRights("Client Details");
                //clientViewModel.ClientID = (int)id;

                //int ClientId;

                //CommonFunctions comfuns = new CommonFunctions();
                //var da = comfuns.FindDA((int)id);
                //clientViewModel.daid = (int)id;

                return(View(clientViewModel));
            }
            catch (Exception ex)
            {
                errorlogviewmodel = new ErrorLogViewModel();
                errorlogviewmodel.LogError(ex);
                return(View("Error"));
            }
        }
Exemplo n.º 2
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"));
            }
        }