public async Task <IActionResult> SaveClientMapping([FromBody] ClientMappingViewModel cmvm)
        {
            try
            {
                CurrentUser cUser = new CurrentUser(HttpContext, _configuration);
                await clientMappingRepo.SaveClientMapping(cmvm);

                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Client Mapping", "Saved Client Mapping");

                return(Ok());
            }
            catch (CustomException cex)
            {
                var returnObj = new EmaintenanceMessage(cex.Message, cex.Type, cex.IsException, cex.Exception?.ToString());
                return(StatusCode(StatusCodes.Status500InternalServerError, returnObj));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new EmaintenanceMessage(ex.Message)));
            }
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <dynamic> > SaveClientMapping(ClientMappingViewModel cmvm)
        {
            string sql = "dbo.EAppSaveClientSiteObserverMapping";

            using (var conn = util.MasterCon())
            {
                try
                {
                    return(await(conn.QueryAsync <dynamic>(sql, new {
                        cmvm.ClientSiteId,
                        cmvm.ObserverDBId,
                        cmvm.ObserverDBName,
                        cmvm.ObserverNodeId,
                        cmvm.ObserverNodeName,
                        cmvm.ObserverNodePath,
                        cmvm.SectorId
                    }, commandType: CommandType.StoredProcedure)));
                }
                catch (Exception ex)
                {
                    throw new CustomException("Unable to Load Data, Please Contact Support!!!", "Error", true, ex);
                }
            }
        }