public async Task <IActionResult> Update([FromBody] BearingViewModel bs)
        {
            try
            {
                CurrentUser cUser  = new CurrentUser(HttpContext, _configuration);
                var         result = await bearingRepo.SaveOrUpdate(bs);

                await auditLogService.LogActivity(cUser.UserId, cUser.HostIP, cUser.SessionId, "Bearing", "Bearing Modified.");

                return(Ok(result));
            }
            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)));
            }
        }
        public async Task <IEnumerable <dynamic> > SaveOrUpdate([FromBody] BearingViewModel bs)
        {
            string sql = "dbo.EAppSaveBearings";

            using (var conn = util.MasterCon())
            {
                try
                {
                    return(await(conn.QueryAsync <dynamic>(sql, new
                    {
                        bs.BearingId,
                        bs.ManufacturerId,
                        bs.LanguageId,
                        bs.BearingCode,
                        bs.BearingName,
                        bs.Descriptions,
                        bs.Active,
                        bs.UserId
                    }, commandType: CommandType.StoredProcedure)));
                }
                catch (SqlException sqlException)
                {
                    if (sqlException.Number == 2601 || sqlException.Number == 2627)
                    {
                        throw new CustomException("Duplicate", "Bearing Code already Exists.", "Error", true, sqlException);
                    }
                    else
                    {
                        throw new CustomException("Due to some Technical Reason, Unable to Save or Update", "Error", true, sqlException);
                    }
                }
                catch (Exception ex)
                {
                    throw new CustomException("Unable to Save Or Update, Please Contact Support!!!", "Error", true, ex);
                }
            }
        }